- Golang: https://go.dev
- Gin framework: https://gin-gonic.com
So why I use choose Gin framework?
- Based on benchmarks: https://gin-gonic.com/docs/benchmarks/
- Gin doesn't build everything from scratch, but relies heavily on Go's standard net/http (also one reason why i don't use fiber, even though fiber has better stats).
- Big community, really the biggest. With twice the stars and contributors of the second place competitor.
- Suitable for building RESTFul API, microservices or realtime applications.
- There is a full tutorial to build up a web server, even in Go Dev official blog!
git clone https://github.com/truongbo17/go-base.git
go mod download
cp .env.example .env
go run main.go migrate
go clean -cache
Run with air(hot reload):
go install github.com/air-verse/air@latest
air server
Or simple:
go run main.go server
Docs
go install github.com/swaggo/swag/cmd/swag@latest
{{host}}/docs/swagger/index.html
Build
make build
- Config ✅
- Command / Console ✅
- Schedule / Cron ✅
- Queue/Job ✅
- Swagger ✅
- Logger ✅
- Database (DocumentDB(MongoDB), Relation DB(MYSQL)) ✅
- Authentication (JWT access token, refresh token) ✅
- Google auth ✅
- Cache (local, redis) ✅
- Redis ✅
- Http call service ✅
- Middleware ✅
- Push notify to telegram ✅
- Migration tool ✅
- File upload (local, s3)
- Kafka (producer, consumer)
- GraphQL
- I18N
- ...