How evrone/go-clean-template works
Main Components
a) External Layer (Infrastructure):
• HTTP Server (Gin Framework)
• RabbitMQ RPC Server
• PostgreSQL Database
• External Web APIs (Google Translation)
b) Controller Layer:
• HTTP Controllers (v1)
• AMQP RPC Controllers
c) Business Logic Layer:
• Use Cases
• Interfaces
• Repositories
d) Entity Layer (Core):
• Domain Models/Entities
Connection and Flow Representation
a) Dependencies:
• All dependencies should point inward towards the core
• Use interface boundaries between layers
b) Data Flow:
• How data travels through layers:
• HTTP Request → Controller → UseCase → Repository → Database
• RPC Request → AMQP Controller → UseCase → External API
Specific Implementation Details
a) HTTP Flow:
External → HTTP Server → v1.Router → Translation Controller →
Translation UseCase → Repository Interface → Postgres Repository
b) RPC Flow:
External → RabbitMQ Server → AMQP Router → Translation Controller →
Translation UseCase → Repository Interface → Postgres Repository
Additional Elements
• Configuration Components
• Logger Service
• Migration Tools
• Integration Test Components
Notes for Implementation
• Dependency inversion principle
• Clear separation between layers
• Interface boundaries between components
• Configuration flow
• Error handling paths
Remember to include the key packages from the project structure:
• cmd/app
• internal/controller (http/v1 and amqp_rpc)
• internal/usecase
• internal/entity
• pkg/* (infrastructure components)
This will provide a comprehensive view of the system's architecture while maintaining the clean architecture principles evident in the project structure.