Boilerplate designed to get you up and running with a project structure optimized for developing REST API services in Go
It promotes the best practices that follow the SOLID principles and clean architecture.
The Boilerplate provides the following features right out of the box:
- RESTful endpoints in the widely accepted format
- Standard CRUD operations of a database table
- JWT-based authentication
- Environment dependent application configuration management
- Structured logging with contextual information
- Error handling with proper error response generation
- Database migration
- Data validation
- Full test coverage
- Live reloading during development
The kit uses the following Go packages which can be easily replaced with your own favorite ones:
- Routing: ozzo-routing
- Database access: ozzo-dbx
- Database migration: golang-migrate
- Data validation: ozzo-validation
- Logging: zap
- JWT: jwt-go
Implementation of API concists of a RESTful API server running at http://127.0.0.1:8080
.
It provides the following endpoints:
GET /health
: a health checkPOST /v1/login
: authenticates a user and generates a JWTGET /v1/projects
: returns a paginated list of the projectsGET /v1/projects/:id
: returns the detailed information of an projectPOST /v1/projects
: creates a new projectPUT /v1/projects/:id
: updates an existing projectDELETE /v1/projects/:id
: deletes an project