How snowmerak/lux works
Main Components
a) Core Framework Components:
• Lux Server Core
• Context Handler
• Controller Layer
• Middleware System
• Provider System
• Signal Handler
b) Request/Response Flow Components:
• REST Controllers
• WebSocket Controllers
• Middleware Chain
• Context Management
┌─────────────────────────────────────────────┐
• Client Layer │
• ┘
• ↕️
┌─────────────────────────────────────────────┐
• Lux Server Core │
• ┌─────────────┐ ┌─────────────────┐ │
• Router │←→│ Context Handler │ │
• ┘ └─────────────────┘ │
• ┘
• ↕️
┌─────────────────────────────────────────────┐
• Controller Layer │
• ┌─────────────┐ ┌─────────────────┐ │
• REST │ │ WebSocket │ │
• Controllers │ │ Controllers │ │
• ┘ └─────────────────┘ │
• ┘
• ↕️
┌─────────────────────────────────────────────┐
• Middleware Chain │
• ┌─────────────┐ ┌─────────────────┐ │
• Request │→│ Response │ │
• Middlewares │ │ Middlewares │ │
• ┘ └─────────────────┘ │
• ┘
• ↕️
┌─────────────────────────────────────────────┐
• Service Layer │
• ┌─────────────┐ ┌─────────────────┐ │
• Services │ │ Providers │ │
• ┘ └─────────────────┘ │
• ┘
Important Relationships
a) Request Flow:
• Client → Lux Server → Context Handler → Middleware Chain → Controller → Service → Response
b) Dependency Injection:
• Provider System → Services → Controllers
c) Middleware Integration:
• How middleware can be inserted at different points in the request lifecycle
Special Components to Highlight
a) Provider System:
• How it manages dependency injection
• Constructor and updater patterns
b) Context Management:
• Demonstrate how it handles request/response lifecycle
• JWT and WebSocket integration
Additional Elements
• Component types
• Special symbols used
Implementation Details
• The modular nature of the framework
• How controllers can be generated and customized
• The middleware chain's flexibility
• The service layer's integration