A robust Go Fiber boilerplate following the Repository Pattern, designed for building scalable web applications.
- Framework: Fiber - Express-inspired web framework
- ORM: GORM with PostgreSQL
- Configuration: Viper for environment management
- Validation: Go Validator
- Hot Reload: Air for development
- Code Generation: Gentool for DAO generation
- Migration tool: Migrate for running migration
- Database: PostgreSQL
- Task Runner: Makefile for common commands
- Database Transaction: Middleware-based transaction handling for write operations (Create, Update, Delete) with automatic commit/rollback based on response status
- Swagger: API documentation using Swagger
Directory | Description |
---|---|
app/constants |
Application constants |
app/controller |
HTTP request handlers |
app/dao |
Data Access Objects |
app/dto |
Data Transfer Objects |
app/errors |
Custom error definitions |
app/middleware |
HTTP middleware |
app/model |
Database models |
app/repository |
Data access layer |
app/request |
Request models |
app/response |
Response models |
app/service |
Business logic |
app/validator |
Request validation |
bootstrap |
Application bootstrap |
config |
Configuration |
database |
Database migrations |
docker |
Docker configurations |
router |
Route definitions |
utils |
Utility functions |
- Clone the repository:
git clone https://github.com/yourusername/fiber-boilerplate.git
cd fiber-boilerplate
- Set up your environment variables
cp .env.example .env
- Build the docker image, install dependency and run project
docker-compose build && docker-compose up -d