- Provides centralized module exports and public API surface
- Constructs the complete HTTP router with all endpoints and middleware layers
- Defines health check endpoints for monitoring and load balancer integration
- Serves static content including admin panel interface
- Implements comprehensive CORS and security policy configuration
- Module Organization: Central module registry and public API definition
- Router Assembly: Complete HTTP route construction with nested path organization
- Middleware Orchestration: Applies security, authentication, audit, and performance middleware layers
- Health Endpoints: Provides deep health checks for database and cache connectivity
- Admin Interface: Serves administrative dashboard and management tools
- API Versioning: Supports both
/api and /api/v1 prefixes for backward compatibility
build_router(): Main router construction function accepting shared application state
ready_check(): Database and cache connectivity verification
serve_admin_panel(): Static HTML content serving for administration
- Route grouping by functional domain (auth, learners, sessions, analytics, etc.)
- Middleware layering with proper ordering for security and functionality
- Module Exports: Consolidates all subsystem modules into cohesive API
- Route Definition: Maps HTTP endpoints to handler functions with proper parameter extraction
- Middleware Application: Applies cross-cutting concerns in correct order
- State Injection: Provides shared application state to all handlers
- Health Verification: Tests database and cache connectivity on demand
- CORS Configuration: Environment-specific cross-origin policy application
- Response Formatting: Consistent JSON response structure across endpoints
- Handler Modules: All domain-specific request handlers (auth, learners, sessions, etc.)
- Middleware Stack: Security headers, authentication, rate limiting, audit logging
- Application State: Database pool, cache connection, configuration access
- Monitoring Systems: Health checks, metrics collection, performance tracking
- Static Assets: Admin panel HTML and related static resources
- WebSocket Support: Real-time session and analytics connections
- Layered Middleware: Onion-style middleware application with proper ordering
- Route Nesting: Hierarchical path organization by functional domain
- Dependency Injection: Shared state container pattern throughout request lifecycle
- Health Check Stratification: Multiple levels of health verification (live/ready/detailed)
- CORS Policy Management: Environment-specific cross-origin configuration
- API Versioning: Multiple endpoint versions for backward compatibility support