How khu-khlug/sight-backend works
Main Components
a. Core Layer:
• Authentication System (auth folder)
• Configuration Management (config folder)
• Persistence Layer (persistence folder)
• Transaction Management (transaction folder)
b. Domain Layer:
• Domain
• User Domain
• Interest Domain
• Seminar Domain
• Cache Domain
• Message Domain
c. Application Layer:
• Command Handlers
• Query Handlers
• Event Handlers
d. Interface Layer:
• REST Controllers
• DTOs
e. Infrastructure Layer:
• Database (MySQL)
• Logger
• External Services
Architectural Patterns to Highlight
• CQRS (Command Query Responsibility Segregation) - evident from the command/query separation
• Domain-Driven Design - clear from the domain organization
• Event-Driven Architecture - presence of event handlers
• Repository Pattern - visible in domain repositories
• Factory Pattern - used in domain object creation
[External Clients] → [Interface Layer (Controllers)]
• ↓
[Application Layer] → [Commands/Queries/Events]
• ↓
[Domain Layer] → [Domain Models/Services/Repositories]
• ↓
[Infrastructure Layer] → [Database/External Services]
Important Relationships
a. Data Flow:
• Client requests → Controllers → Command/Query Handlers → Domain Services → Repositories → Database
• Event flows from Domain Events → Event Handlers → External Services
b. Dependencies:
• How the auth guard protects routes
• Transaction boundaries
• Event publishing/handling paths
Special Components to Highlight
• Authentication/Authorization flow
• Transaction management system
• Management functionality
• User management system
• Point system
• Door lock password management (InfraBlue)
Technical Stack Elements
• NestJS Framework
• MySQL Database
• Docker Container
• MikroORM (based on configuration file)
Implementation Details
• Core Business Logic (Group, User, Interest domains)
• Infrastructure Services (Logger, Database)
• Cross-cutting Concerns (Auth, Configuration)
• External Integrations (Slack, InfraBlue)