Skip to main content

System Architecture Overview

Overview

Learnille is architected as a modular, package-decoupled digital learning platform. It isolates backend REST API logic, real-time sync, background job workers, search indexing, media storage, and frontend client applications into focused packages, designed for self-hosted infrastructure.


🏗 Architecture Components

+-----------------------------------------------------------------------------------+
| FRONTEND PORTALS |
| +--------------------+ +--------------------+ +-----------------------------+ |
| | Student Web | | Instructor Portal | | Consultant & Admin Portals | |
| | (Vite+React+TS) | | (Vite+React+TS) | | (Vite+React+TS) | |
| +---------+----------+ +---------+----------+ +--------------+--------------+ |
+------------|-----------------------|----------------------------|-----------------+
| | |
+-----------------------+----------------------------+
|
REST API & WebSocket Connections
|
v
+-----------------------------------------------------------------------------------+
| NESTJS SERVER BACKEND API |
| +-----------------------------------------------------------------------------+ |
| | Controllers: Auth, User, Course, Consultation, Wallet, Validation, Analytics| |
| | Guards: JwtAuthGuard, RolesGuard, CASL Ability | |
| | Interceptors: TransformInterceptor, TimeoutInterceptor, LoggingInterceptor | |
| +-----------------------------------------------------------------------------+ |
+------+---------------+---------------+---------------+---------------+------------+
| | | | |
v v v v v
+--------------+ +-----------+ +---------------+ +-----------+ +---------------+
| PostgreSQL | | InstantDB | | Soketi / WS | | BullMQ | | OpenSearch |
| (Self-Hosted | | (Realtime | | (Notification | | (Queues | | (Search Vector|
| TypeORM DB) | | State) | | Websockets) | | & Outbox) | | Indexing) |
+--------------+ +-----------+ +---------------+ +-----------+ +---------------+

🛠 Technology Stack Breakdown

Layer / SubsystemPrimary TechnologiesPurpose
Backend FrameworkNestJS (TypeScript), Passport JWTRESTful API, DTO validation, Modular business logic
Primary DatabaseSelf-Hosted PostgreSQL, TypeORMRelational persistence (Users, Courses, Bookings, Transactions)
Real-time State SyncInstantDBReal-time state synchronization for active sessions, presence, and chat
WebSocket BroadcastSoketi (Pusher protocol)Live push notifications and real-time UI counters
Background QueuesBullMQ, RedisAsync jobs (Email delivery, outbox event processing, media transcode)
Search EngineOpenSearch / ElasticsearchCourse catalog indexing, full-text search, and recommendations
Object StorageCloudflare R2 (S3 API) / MinIOVideo asset storage, thumbnails, attachments, zero-egress fee storage
Monitoring & LoggingNew Relic APM & Logs, SentryApplication performance monitoring, log aggregation, exception tracking
NotificationsNovuMulti-channel notification pipeline (Email, Push, In-App)
Payment GatewaysPaystack, FlutterwaveMulti-currency card payments, mobile money, and NGN/USD bank payouts
Frontend FrameworkReact 18, Vite, TypeScriptFast SPA client applications (student, instructor, admin, consultant)
UI ComponentsChakra UI, CSS VariablesResponsive visual design system and component UI

📌 Architectural Guarantees & Guardrails

  1. Package Separation: Type definitions cannot be cross-imported between child package folders. Types must be defined within their respective package or shared via explicit boundaries.
  2. Database Naming: PostgreSQL entities use snake_case column naming transformations.
  3. Controller Security: All controllers are protected by JwtAuthGuard. Authenticated user context is accessed exclusively via @CurrentUser().
  4. Validation Enforcement: All incoming payload data must be validated using explicit DTOs with ValidationPipe.