How dubjay18/qraven works
Main Components
A. API Layer
• Entry point through cmd/api/main.go
• REST endpoints organized by domain (auth, event, ticket)
• Swagger documentation integration (visible in docs directory)
B. Core Services Layer
• Authentication Service
• Event Service
• Ticket Service
• Payment Service
• Notification Service
C. Data Layer
• PostgreSQL Database
• Redis Cache
D. Middleware Layer
• Authorization
• Metrics
• Security
• Token Management
Component Relationships
Client Requests
• ↓
API Gateway (Gin Framework)
• ↓
Middleware Layer
• ↓
Router Layer
• ↓
Controllers
• ↓
Services
• ↓
Repository Layer
• ↙ ↘
PostgreSQL Redis
Specific Implementation Details
• Rectangles: Core services (auth, event, ticket, payment, notification)
• Hexagons: Middleware components
• Rounded rectangles: Controllers and routers
• Blue: API and routing layers
• Green: Services
• Yellow: Middleware
• Red: Databases
• Purple: External services/utilities
Key Architectural Patterns to Highlight
A. Layer Separation:
• Clear separation between controllers, services, and repositories
• Repository pattern implementation for data access
• Service layer for business logic
B. Data Storage:
• PostgreSQL for persistent storage
• Redis for caching
• Different operations (CRUD) available in both storage types
Additional Elements
Supporting components:
• Configuration management (internal/config)
• Model definitions (internal/models)
• Utility functions (utils package)
• Migration handling (internal/models/migrations)
Flow Directions
• Request flow from client → API → Services → Data layer
• Response flow back to client
• Cache interaction flows
• Database transaction flows
┌─ External Clients ─┐
• REST / HTTP │
• ┬────────┘
• ↓
┌─── API Gateway ───┐
• Gin Router │
• ┬────────┘
• ↓
┌─── Middleware ────┐
• Auth | Metrics │
• ┬────────┘
• ↓
┌─── Controllers ───┐
• Auth|Event|Ticket │
• ┬────────┘
• ↓
┌──── Services ─────┐
• Business Logic │
• ┬────────┘
• ↓
┌── Repository ─────┐
• Data Access Layer │
• ┬─────┬─────┘
• ↓ ↓
• [PostgreSQL] [Redis]
Important Notes
• Clear boundaries between different layers
• Where middleware intercepts requests
• Caching strategy with Redis
• How authentication flows through the system
• Error handling flows
• Points of external service integration