All Projects โ†’ utain โ†’ go-12factor-example

utain / go-12factor-example

Licence: MIT license
Example the 12factor app using golang

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects
shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to go-12factor-example

Ugin
UGin is an API boilerplate written in Go (Golang) with Gin Framework.
Stars: โœญ 110 (+450%)
Mutual labels:  example, gin, gorm
go api boilerplate
๐ŸถGo (Golang)๐Ÿš€REST / GraphQL API + Postgres boilerplate
Stars: โœญ 127 (+535%)
Mutual labels:  gin, gorm, gin-gonic
Ultimate Go
This repo contains my notes on working with Go and computer systems.
Stars: โœญ 1,530 (+7550%)
Mutual labels:  example, gin, gorm
Go Project Sample
Introduce the best practice experience of Go project with a complete project example.้€š่ฟ‡ไธ€ไธชๅฎŒๆ•ด็š„้กน็›ฎ็คบไพ‹ไป‹็ปGo่ฏญ่จ€้กน็›ฎ็š„ๆœ€ไฝณๅฎž่ทต็ป้ชŒ.
Stars: โœญ 344 (+1620%)
Mutual labels:  example, gin, gorm
Golang Gin Realworld Example App
Exemplary real world application built with Golang + Gin
Stars: โœญ 1,780 (+8800%)
Mutual labels:  example, gin, gorm
ginadmin
ๅŸบไบŽGinๅผ€ๅ‘็š„ๅŽๅฐ็ฎก็†็ณป็ปŸ๏ผŒ้›†ๆˆไบ†ใ€ๆ•ฐๆฎๅบ“ๆ“ไฝœใ€ๆ—ฅๅฟ—็ฎก็†ใ€ๆƒ้™ๅˆ†้…็ฎก็†ใ€ๅคšๆจกๆฟ้กต้ขใ€่‡ชๅŠจๅˆ†้กตๅ™จใ€ๆ•ฐๆฎๅบ“่ฟ็งปๅ’Œๅกซๅ……ใ€Docker้›†ๆˆ้ƒจ็ฝฒ็ญ‰ๅŠŸ่ƒฝใ€้™ๆ€่ต„ๆบๆ‰“ๅŒ…
Stars: โœญ 149 (+645%)
Mutual labels:  gin, gorm
ginhelper
gin framework helper
Stars: โœญ 16 (-20%)
Mutual labels:  gin, gin-gonic
pink-lady
a template project of gin app.
Stars: โœญ 44 (+120%)
Mutual labels:  gin, gorm
kuu
Modular Go Web Framework based on GORM and Gin.
Stars: โœญ 15 (-25%)
Mutual labels:  gin, gorm
golang-example-app
Example application
Stars: โœญ 138 (+590%)
Mutual labels:  gorm, cobra
logger
Gin middleware/handler to logger url path using rs/zerolog
Stars: โœญ 119 (+495%)
Mutual labels:  gin, gin-gonic
ego
GoๅพฎๆœๅŠก.A simple and component-based microservice kit for go.
Stars: โœญ 765 (+3725%)
Mutual labels:  gin, gorm
go-gin-logrus
Gin Web Framework for using Logrus as the Gin logger with Tracing middleware
Stars: โœญ 38 (+90%)
Mutual labels:  gin, gin-gonic
public
util toolkit for go.golang ้€š็”จๅ‡ฝๆ•ฐๅŒ…
Stars: โœญ 135 (+575%)
Mutual labels:  gorm, cobra
requestid
Request ID middleware for Gin Framework
Stars: โœญ 115 (+475%)
Mutual labels:  gin, gin-gonic
laya-template
ๆœๅŠกๅŸบๆœฌๆก†ๆžถ๏ผŒtemplate
Stars: โœญ 13 (-35%)
Mutual labels:  gin, gorm
gt-crud
gin+gorm+mysql+api[ไธคๆญฅ่‡ชๅŠจcrud]
Stars: โœญ 15 (-25%)
Mutual labels:  gin, gorm
website
Official website and document for Gin
Stars: โœญ 88 (+340%)
Mutual labels:  gin, gin-gonic
iam
ไผไธš็บง็š„ Go ่ฏญ่จ€ๅฎžๆˆ˜้กน็›ฎ๏ผš่ฎค่ฏๅ’ŒๆŽˆๆƒ็ณป็ปŸ
Stars: โœญ 1,900 (+9400%)
Mutual labels:  gin, gorm
gin-gorm-api-example
[Article] Minimal code for Golang based API
Stars: โœญ 98 (+390%)
Mutual labels:  gin, gorm

GO Example (Web Service)

Trying to implement follow The Twelve Factor App

Dependencies

  1. Command-line interface: github.com/spf13/cobra
  2. Configuration: github.com/spf13/viper
  3. Testing: github.com/stretchr/testify
  4. Mocking DB: github.com/DATA-DOG/go-sqlmock
  5. ORM: gorm.io/gorm
  6. Logging: github.com/op/go-logging
  7. HTTP Server: github.com/gin-gonic/gin
  8. API Document: github.com/swaggo/swag/cmd/swag

Project structure

.
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ Makefile
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ cmd
โ”‚   โ”œโ”€โ”€ othercmd # example other command line app
โ”‚   โ””โ”€โ”€ server   # start reading code from here
โ”œโ”€โ”€ internal
โ”‚   โ”œโ”€โ”€ api/v1
โ”‚   โ”œโ”€โ”€ config
|   |-- dto
โ”‚   โ”œโ”€โ”€ entities
|   |-- errors
|   |-- log
โ”‚   โ”œโ”€โ”€ services
โ”‚   โ””โ”€โ”€ utils
โ”œโ”€โ”€ config
โ”‚   โ””โ”€โ”€ default.yaml
โ”œโ”€โ”€ docs
โ”œโ”€โ”€ dist
โ”‚   โ”œโ”€โ”€ drawin
โ”‚   โ”œโ”€โ”€ linux
โ”‚   โ””โ”€โ”€ windows
โ”œโ”€โ”€ docker-compose.yml
โ”œโ”€โ”€ go.mod
โ””โ”€โ”€ go.sum

Get started

Cross platform build environment setup

macOS

# install dep to build binary for linux and windows
brew install FiloSottile/musl-cross/musl-cross
brew install mingw-w64

Command Line

Run project with docker compose

docker compose -f dev.yml up --build

Run project without build

go run ./cmd/server [command] --[flag-name]=[flag-value]

Generate API Document

make doc
# open url http://localhost:5000/doc/index.html

Build using make command

# Build single binary with specify os
make build[-mac|win|linux]
# Build all os
make all
# Running test
make test
# Start server without build binary file
make run

Build with docker

docker compose build # build docker image
docker compose up # run on docker
# or
docker compose up --build # build and run
docker push [image-name] # public docker image to registry

Configuration

Viper uses the following precedence order. Each item takes precedence over the item below it:

  • explicit call to Set
  • flag
  • env
  • config
  • key/value store
  • default

Example List

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].