HI
hiennguyen9874/go-boilerplate-v2
Go boilerplate with entgo
Go Restful API Boilerplate
An API Boilerplate written in Golang with chi-route and entgo. Write restful API with fast development and developer friendly.
Architecture
In this project use 3 layer architecture
- Models
- Repository
- Usecase
- Delivery
Features
- CRUD
- Jwt, refresh token saved in redis
- Cached user in redis
- Email verification
- Forget/reset password, send email
Technical
chi: router and middlewareviper: configurationcobra: CLI featuresentgo: ormvalidator: data validationjwt: jwt authenticationzap: loggergomail: emailhermes: generate email bodyair: hot-reload
Start Application
Generate the Private and Public Keys
- Generate the private and public keys: travistidwell.com/jsencrypt/demo/
- Copy the generated private key and visit this Base64 encoding website to convert it to base64
- Copy the base64 encoded key and add it to the
config/config-local.ymlfile asjwt - Similar for public key
Stmp mail config
- Create mailtrap account
- Create new inboxes
- Update smtp config
config/config-local.ymlfile assmtpEmail
Run
docker-compose up- Swagger: localhost:5000/swagger/
TODO
- Traefik
- Config using .env
- Linter
- Jaeger
- Production docker file version
- Mock database using gomock
On this page
Languages
Go98.8%Shell0.8%Python0.4%
Contributors
Created April 26, 2023
Updated May 19, 2025