How goodfoodcesi/auth-api works
Main Components
a. External Layer (Client Interface):
• HTTP API Gateway/Load Balancer (Traefik, indicated by docker-compose-traefik.yaml)
• Rate Limiter (from middleware)
b. Application Core:
• HTTP Interface Layer
• Auth Handler
• User Handler
• Middleware (Authentication, Logging, Rate Limiting)
c. Domain Layer:
• Services
• Auth Service
• User Service
• Messaging Service
d. Infrastructure Layer:
• Database (SQL database, indicated by migrations)
• RabbitMQ Message Broker
• JWT Token Service
• Logger (Zap)
e. Background Workers:
• Message Consumer Service
Component Relationships
• External clients → Traefik Gateway
• Gateway → HTTP Interface Layer
• HTTP Handlers → Domain Services
• Domain Services → Infrastructure Layer
• Message Broker → Consumer Service
• All components → Logger
Specific Implementation Details
• Blue rectangles: External interfaces (API Gateway, Load Balancer)
• Green rectangles: Application services (Handlers, Domain Services)
• Yellow diamonds: Infrastructure components (Database, Message Queue)
• Red rectangles: Security components (JWT, Auth Middleware)
• Purple rectangles: Background processes (Consumers)
Data Flow Indicators
Following flows:
• Authentication flow: Client → Gateway → Auth Handler → Auth Service → JWT Service
• User operations flow: Client → Gateway → User Handler → User Service → Database
• Messaging flow: Services → RabbitMQ → Consumer
Deployment Context
A separate section showing:
• Kubernetes deployment structure (from kube directory)
• Development vs Production environments
• Container orchestration
Technical Stack Callouts
Following technologies:
• Go (main implementation language)
• PostgreSQL (indicated by SQL migrations)
• RabbitMQ (message broker)
• Traefik (reverse proxy)
• Kubernetes (container orchestration)
• Docker (containerization)
Additional Elements
Annotations for:
• Security measures (rate limiting, JWT authentication)
• Database migrations
• API versioning (if applicable)
• Monitoring and logging points
• External interfaces at the top
• Application logic in the middle
• Infrastructure components at the bottom
Related components
• Keep all authentication-related components together
• Database operations
• Cluster messaging components
Environment boundaries
• Development environment
• Production environment
• Testing environment
This structure reflects the clean architecture pattern evident in the project's organization, with clear separation between interfaces, domain logic, and infrastructure concerns, while also showing the modern cloud-native aspects of the system including message queuing, containerization, and orchestration.