How kitabisa/buroq works
Main Components
a) API Layer:
• HTTP Server (using chi router)
• GraphQL Server
• Health Check Endpoint
• OpenAPI Specification (located in /api)
b) Core Application Components:
• Handler Layer
• Service Layer
• Repository Layer
• Cache Layer
c) Data Storage:
• MySQL Database
• PostgreSQL Database
• Redis Cache
d) Supporting Components:
• Migration System
• Seeding System
• Metrics Collection (InfluxDB - planned)
┌─────────────────┐
• Client Layer │
• ┬────────┘
• ↓
┌─────────────────┐
• API Layer │
• ┬────────┘
• ↓
┌─────────────────┐
• Service Layer │
• ┬────────┘
• ↓
┌─────────────────┐
• Storage │
• ┘
Detailed Component Representation
• Rectangles: Main service components
• Hexagons: External services/interfaces
• Blue: Core application components
• Green: Data storage
• Yellow: External interfaces
• Gray: Supporting systems
Component Relationships
Following flows:
• HTTP/GraphQL requests flow through the layers
• Database access patterns
• Cache interaction patterns
• Migration/Seeding flows
Key Architectural Patterns to Highlight
a) Clean Architecture Pattern:
• Clear separation between handlers, services, and repositories
• Demonstrate dependency flow from outer to inner layers
b) Repository Pattern:
• How the repository layer abstracts database operations
• Relationship between repositories and different database drivers
Implementation Details
internal/app/
• handler/
• service/
• repository/
• graphql/
Additional Elements
Annotations for:
• Configuration management
• Middleware chain
• Error handling flow
• Metrics collection points
Technical Stack Callouts
Technologies:
• Go-Chi Router
• GORP as ORM
• Redigo for Redis
• SQL-Migrate for migrations
• GraphQL implementation
Remember to include the planned/WIP features (like metrics and seeding) but mark them distinctly as future additions.