-
Notifications
You must be signed in to change notification settings - Fork 21
Open
7 / 87 of 8 issues completedDescription
Overview
This proposal outlines a standard application template for building backend services in Golang. The template emphasizes clean architecture and will be designed to support RESTful API development.
Required Component
- Project Structure : Follows Golang’s Clean Architecture principles, structured into Model, Repository, Usecase, and Delivery layers.
- Database Migration: Manage database schema changes using goose.
- Table Seeders: Manage how to seed data into existing table.
- Database Integration: Establish a connection to a PostgreSQL database.
- Environment Configuration: Use .env files and a configuration management package for managing environment-specific settings.
- Routing & HTTP Server: Setup RESTful routes using echo.
- Error Handling: Centralized error handling strategy with custom error types and HTTP response formatting.
- Logging: Implement structured, leveled logging using slog.
- Docker Support: Provide Dockerfile and docker-compose.yml for development.
- Testing: Implement test using Go's testing package.
- API Documentation: Support API documentation.
- Authentication: Provide authentication example.
Optional Components
- Task Scheduling: Support background job scheduling.
- Monitoring: Application metrics in Prometheus format for observability.
- Tracing: Integrate with OpenTelemetry to enable request tracing, performance monitoring, and visualization. #49
- Logging the execution time for Pgx queries
Proposed Package / Library
| Component | Suggested Libraries / Tools |
|---|---|
| Database Migration | github.com/pressly/goose |
| Database Integration | github.com/jackc/pgx/v5 |
| Environment Config | github.com/joho/godotenv |
| Routing & HTTP Server | github.com/labstack/echo/v4 |
| Logging | log/slog |
| Error Handling | Manual or github.com/pkg/errors |
| Task Scheduling | github.com/go-co-op/gocron |
| API Documentation | https://pkg.go.dev/github.com/swaggo/echo-swagger |
Reference
- ZOG internal project with Go
- https://medium.easyread.co/golang-clean-archithecture-efd6d7c43047
Sub-issues
Metadata
Metadata
Assignees
Labels
No labels