- Could be used to provide quick bootstrap functionality for your next go and gofiber app.
- I will update(try) this regularly to add functionality and new features.
- Well this is just one way of doing it, not the official or the best 😅.
Used libraries:
- Gofiber Docker Dev Setup with Hot Reload
- User Auth functionality (Signup, Login, Forgot and Reset Password)
- JWT Authentication
- RESTful API
- Swagger REST API documentation
- Gorm (Golang SQL DB ORM) with Postgres implementation and auto migration
- MongoDB using the official mongo driver
- Configs via environmental variables
- Improved Input Validations(could be better)
- Custom Error messages
- Email notification (Welcome email, Reset password email)
- Redis
- Casbin
- WebSocket
- gRPC
- Improve MongoDB data integrity
- Create
.env
at src, i.e.
cp src/.env.example src/.env
- Download Swag for generating docs
go get -u github.com/swaggo/swag/cmd/swag
- Run
- NOTE: You have to generate swagger docs before running the app.
# Terminal 1
swag init -g src/api/app.go --output ./src/api/docs # Generates Swagger
# Terminal 2
docker-compose --env-file ./src/.env up # docker-compose up (Run App With AutoReload)
docker-compose --env-file ./src/.env down # docker-compose down (Shutdown App)
- API
http://localhost:8000/api/v1
- Swagger Doc
http://localhost:8000/api/v1/docs
- Create
.env
at src, i.e.
cp src/.env.example src/.env
- Update your
.env
variables for production
- Point to your prod database
- Update JWT issuer, secret key , blah blah
- Basically just follow good production practice
- Download Swag for generating docs
go get -u github.com/swaggo/swag/cmd/swag
- Generate Swagger Docs. You have to generate swagger docs before packaging the app.
swag init -g src/api/app.go --output ./src/api/docs # Generates Swagger
- Build Your Image
- Permission the build script to run.
chmod +x docker-build.sh
- You could set the image port on
Dockerfile.prod
- Run the build script. You must provide a version tag as shown below.
./docker-build.sh -v gofiber:1.0.0
- Data Migrations ?
- Logger
- Unit tests
maybe?
- SMS notification (2FA ,Reset password code)
- GraphQL
- Deploy on Kubernetes
- Write an article
- Building Swago from source code -
go build -o swag.exe cmd/swag/main.go
Open to Suggestions and Pull Requests