MCPcopy
hub / github.com/gothinkster/golang-gin-realworld-example-app

github.com/gothinkster/golang-gin-realworld-example-app @0.0.6 sqlite

repository ↗ · DeepWiki ↗ · release 0.0.6 ↗
124 symbols 311 edges 17 files 33 documented · 27%
README

RealWorld Example App

Build Status codecov License: MIT GoDoc

Golang/Gin codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

This codebase was created to demonstrate a fully fledged fullstack application built with Golang/Gin including CRUD operations, authentication, routing, pagination, and more.

How it works

.
├── gorm.db
├── hello.go
├── common
│   ├── utils.go        //small tools function
│   └── database.go     //DB connect manager
└── users
    ├── models.go       //data models define & DB operation
    ├── serializers.go  //response computing & format
    ├── routers.go      //business logic & router binding
    ├── middlewares.go  //put the before & after logic of handle request
    └── validators.go   //form/json checker

Getting started

Install the Golang

https://golang.org/doc/install

Environment Config

make sure your ~/.*shrc have those varible:

➜  echo $GOPATH
/Users/zitwang/test/
➜  echo $GOROOT
/usr/local/go/
➜  echo $PATH
...:/usr/local/go/bin:/Users/zitwang/test//bin:/usr/local/go//bin

Install Govendor & Fresh

I used Govendor manage the package, and Fresh can help build without reload

https://github.com/kardianos/govendor

https://github.com/pilu/fresh

cd 
go get -u github.com/kardianos/govendor
go get -u github.com/pilu/fresh

Start

➜  govendor sync
➜  fresh

Testing

➜  go test -v ./... -cover

Todo

  • More elegance config
  • Test coverage (common & users 100%, article 0%)
  • ProtoBuf support
  • Code structure optimize (I think some place can use interface)
  • Continuous integration (done)

Core symbols most depended-on inside this repo

GetArticleUserModel
called by 9
articles/models.go
GetFollowings
called by 8
users/models.go
FindOneArticle
called by 6
articles/models.go
Response
called by 6
articles/serializers.go
UpdateContextUserModel
called by 4
users/middlewares.go
setPassword
called by 4
users/models.go
checkPassword
called by 4
users/models.go
FindOneUser
called by 4
users/models.go

Shape

Function 68
Method 28
Struct 28

Languages

Go100%

Modules by API surface

articles/models.go20 symbols
articles/serializers.go16 symbols
articles/routers.go15 symbols
users/models.go12 symbols
users/routers.go10 symbols
common/unit_test.go8 symbols
users/validators.go7 symbols
users/unit_test.go7 symbols
articles/validators.go7 symbols
users/serializers.go6 symbols
common/utils.go6 symbols
common/database.go5 symbols

For agents

$ claude mcp add golang-gin-realworld-example-app \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact