How mandarine-io/backend works
Main Components
a. Core Application Layer:
• HTTP Server (Gin Gonic)
• WebSocket Server
• Authentication System (JWT + OAuth2 providers)
• Service Layer
• Domain Layer
• Repository Layer
b. External Services:
• PostgreSQL with PostGIS
• Redis (for caching and pub/sub)
• MinIO (S3-compatible storage)
• SMTP Server
• Multiple Geocoding Providers
• OAuth2 Providers
[Client Layer]
[Transport Layer]
[Service Layer]
[Persistence Layer]
[External Services]
Component Details
a. Transport Layer (internal/transport):
• HTTP Handlers (/v0/*)
• WebSocket Handler
• Middleware Components
• Input Validators
b. Service Layer (internal/domain/service):
• Account Service
• Auth Service
• Geocoding Service
• Health Service
• Master Profile Service
• Resource Service
• WebSocket Service
c. Persistence Layer:
• GORM Repositories
• Cache Managers (Redis/Memory)
• File Storage (MinIO)
d. External Services Integration:
• Multiple Geocoding Providers (Graphhoper, Here, LocationIQ, etc.)
• OAuth Providers (Google, Yandex, Mail.ru)
• Email Service
Important Architectural Patterns to Highlight
• Clean Architecture pattern (visible in the layer separation)
• Repository Pattern (for data access)
• Factory Pattern (for geocoding and OAuth providers)
• Pub/Sub Pattern (using Redis)
• Middleware Chain Pattern (for HTTP handlers)
Additional Elements
• Background jobs (internal/job)
• Health check system
• Configuration management
• Caching strategy
• Security layer (JWT, middleware)
• Database migrations flow
Key Interactions to Highlight
• Authentication flow with multiple OAuth providers
• Geocoding service provider selection and failover
• WebSocket connection handling and pooling
• Cache layer interaction with database
• File storage operations with MinIO
• Health check system monitoring all components