Go Fiber Microservice with hexagonal architecture, security, OpenApi, tracing, etc
- Go 94.3%
- Makefile 5.5%
- Dockerfile 0.2%
| adapter | whisql | |
| application | whisql and upgrades | |
| cmd | whisql and upgrades | |
| docs | fix swagger | |
| internal | whisql and upgrades | |
| migrations | nilo.Option update | |
| pagination | whisql and upgrades | |
| tests | whisql and upgrades | |
| .gitignore | handlers and testing | |
| Dockerfile | db migrations | |
| go.mod | whisql | |
| go.sum | whisql | |
| LICENSE | whisql and upgrades | |
| Makefile | fix swagger | |
| README.md | whisql and upgrades | |
fiber-micro
Microservice API applying clean architecture, security, OpenApi, tracing, etc
Dependencies
Golang, Docker, Make, Swag tool
Features
- Architecture
- Clean architecture (adapters and ports)
- Custom Messages and Errors
- Pagination and Ordering
- DB Migrator (scripts)
- Go 1.26
- Libraries
- Web: Fiber V3
- WhiSQL: Database SQL adapter
- Security: JWT
- Validations: Go Playground Validator
- Unit Test: Testify
- DB: Postgres
- Tracing: Opentelemetry
- Test: Testcontainers
- OpenAPI: Fiber Swagger
- Environment: Godot
- Distributed tracing
- OpenTelemetry and Jaeger
- Swagger
- Swaggo & Fiber Swagger V3
- Auditory
- Database
- Postgres
- Testcontainers
Files
Enviroment variables
# SQL
DATABASE_URL=postgres://admin:admin@localhost:5432/db_users
SHOW_SQL_INFO=false
# Jaeger tracing endpoint
TRACING_HOST=localhost:4318
# Swagger
SWAGGER_ENABLED=true
# Security JWT
SECURITY_ENABLED=true
JWT_DURATION=300
JWT_SECRET_KEY=UUID
JWT_ISSUER=https://acme.com
JWT_AUDIENCE=https://acme.com
Usage
- Executing
make helpall the available commands will be listed. - Also the standard Go commands could be used, like
go run main.go - To use this archetype with a different name, execute this command to replace the names:
find . -type f -exec sed -i 's/go-microservice/your-project-name/g' {} +
Services
- Create users POST: /users
- Get users GET: /users
- Login POST: /users/login