How fatkharrofiqi/go-starter-template works
This Go starter backend serves HTTP APIs for JWT-based authentication and user management. The main workflow is client request → Fiber routing/middleware → controller validation and request handling → service business logic → PostgreSQL or Redis → response; authentication additionally issues, validates, refreshes, and blacklists tokens. The graph also preserves configuration, tracing, and database seeding capabilities. Source excerpts establish the principal wiring and service calls; links to unsampled routing or configuration internals are omitted where their invocation is not shown.
Main entry points: app.go Application bootstrap · auth_service.go Authentication service · route.go HTTP routes · user_service.go User service
Components 22
Runtime and configuration
- Server entry point
cmd/app/main.go - Application bootstrap
internal/app.go - Runtime configuration
internal/config/env/config.go - Tracing setup
internal/config/monitor/monitoring.go - Seeder entry point
cmd/seed/main.go
HTTP API
- HTTP routes
internal/route/route.go - Auth controller
internal/controller/auth_controller.go - User controller
internal/controller/user_controller.go - Welcome controller
internal/controller/welcome_controller.go - Request validation
internal/config/validation/validation.go
Identity and access
- Auth middleware
internal/middleware/auth_middleware.go - Authentication service
internal/service/auth_service.go - JWT service
internal/service/jwt_service.go - Blacklist service
internal/service/blacklist_service.go - Token blacklist
internal/repository/token_blacklist_repository.go
User management and storage
- User service
internal/service/user_service.go - User repository
internal/repository/user_repository.go - User response converter
internal/dto/converter/user_to_response.go - PostgreSQL
- Redis
- Seed data
db/seeder/seeder.go
Other components
- API client
Connections 29
- API client → HTTP routes: sends requests
- Server entry point → Runtime configuration: loads config
cmd/app/main.go - Server entry point → Tracing setup: starts tracing
cmd/app/main.go - Server entry point → Application bootstrap: runs server
cmd/app/main.go - Application bootstrap → HTTP routes: registers routes
internal/app.go - Application bootstrap → Auth controller: provides controller
internal/app.go - Application bootstrap → User controller: provides controller
internal/app.go - Application bootstrap → Welcome controller: provides controller
internal/app.go - HTTP routes → Auth controller: routes auth
- HTTP routes → User controller: routes users
- HTTP routes → Auth middleware: protects routes
- Auth controller → Request validation: validates input
internal/controller/auth_controller.go - Auth controller → Authentication service: handles auth
internal/controller/auth_controller.go - User controller → User service: handles user actions
internal/controller/user_controller.go - User controller → Auth middleware: reads claims
internal/controller/user_controller.go - Auth middleware → Blacklist service: checks blacklist
internal/middleware/auth_middleware.go - Auth middleware → JWT service: validates access
internal/middleware/auth_middleware.go - Authentication service → JWT service: issues tokens
internal/service/auth_service.go - Authentication service → User repository: loads and creates users
internal/service/auth_service.go - Authentication service → Blacklist service: checks and revokes
internal/service/auth_service.go - Authentication service → User repository: runs transaction work
- Blacklist service → Token blacklist: checks and stores tokens
- Token blacklist → Redis: reads and writes
internal/repository/token_blacklist_repository.go - User service → User repository: reads and writes users
internal/service/user_service.go - User service → User response converter: converts responses
internal/service/user_service.go - User repository → PostgreSQL: queries users
internal/repository/user_repository.go - User service → Redis: caches profile
internal/service/user_service.go - Seeder entry point → Seed data: runs seeding
cmd/seed/main.go - Seeder entry point → PostgreSQL: opens database