Learnyst is a production-grade, highly scalable Learning Management System (LMS) designed for course creators, universities, and coaching academies to host, manage, and securely deliver online courses. Built with a modern microservices architecture in Go and Next.js, it offers robust multi-tenancy, a custom event-driven video transcoding pipeline, and a stunning, high-contrast brutalist UI ("Ada Aesthetic").
- True Multi-Tenancy: Each academy operates as an isolated tenant with custom subdomains (e.g.,
academy1.learnyst.com), segregated data, and dedicated branding. - Adaptive HLS Video Streaming:
- Lightning-fast local
FFMPEGprocessing via shared Docker volumes (bypasses slow cloud egress). - Automated multi-bitrate HLS chunking (1080p, 720p, 480p) optimized for zero-buffering with strict GOP forcing (
-g 48 -hls_time 4). - Direct-to-cloud sync to Azure Blob Storage with automated CORS configuration.
- Fallback mechanics to handle videos lacking audio streams.
- Lightning-fast local
- Asynchronous Event-Driven Pipeline: Leverages Kafka message brokering to decouple heavy workloads like video transcoding from core API traffic, ensuring 99.9% uptime.
- Ada Aesthetic UI: A bold, high-contrast, brutalist-inspired Next.js frontend built with Tailwind CSS, delivering a highly premium and modern learning experience.
- Comprehensive Course Management: Support for dynamic curriculum building, including video lectures, downloadable lecture notes (PDFs), and assignments.
- Role-Based Access Control (RBAC): Distinct portals and capabilities for System Admins, Tenant Owners, Teachers, and Students.
Learnyst uses a highly decoupled microservices architecture to ensure scalability, fault tolerance, and developer velocity.
- Role: The central entry point for all frontend client requests.
- Stack: Go (Gin).
- Responsibilities: Handles global rate limiting, CORS configuration, JWT authentication verification, and routes authenticated traffic to the respective downstream microservices.
- Role: The brains of the platform.
- Stack: Go (Gin, GORM).
- Responsibilities: Manages tenant creation, course logic, user enrollments, staff assignments, and handles the initial video ingestion. It intercepts raw
.mp4uploads and saves them to a shared local Docker volume (/shared), preventing expensive and slow double-hops to cloud storage.
- Role: Heavy-duty asynchronous processor.
- Stack: Go, Sarama (Kafka), FFMPEG.
- Responsibilities: Consumes
video.uploadedKafka events. Reads the raw video from the local shared disk, spins up an optimized FFMPEG sub-process to generate keyframe-aligned multi-bitrate.m3u8playlists and.tschunks, pushes them to Azure Blob Storage, and emits avideo.transcodedevent upon completion.
- Role: Subdomain routing layer.
- Stack: Go.
- Responsibilities: Intercepts traffic at the edge, reads the HTTP Host header, resolves the subdomain to a specific Tenant ID in the database, and injects tenant context into downstream requests.
- Role: User-facing web application.
- Stack: Next.js 14, React, Tailwind CSS, TypeScript, Video.js.
- Responsibilities: Provides the "Ada Aesthetic" dashboards for teachers to build courses and students to consume content via custom Video.js HLS players.
- PostgreSQL 17: Primary relational datastore (Users, Courses, Tenants, Roles). Configured with replica instances for read-heavy operations.
- Redis 7: High-speed in-memory datastore for caching tenant lookups, rate limiting, and session management.
- Kafka 7.5 & Zookeeper: High-throughput message broker handling the event stream for background jobs (e.g.,
video.uploaded,video.transcoded,email.send). - Cassandra 4.1: High-throughput NoSQL storage designed for writing massive amounts of analytical data and tracking user video progression/logs.
- Azure Blob Storage: Long-term cold and warm storage for serving public/private HLS video chunks, PDF notes, and image thumbnails.
Our optimized HLS pipeline is built to solve the notorious "infinite buffering" and "cloud egress" problems typical in VOD platforms:
- Ingestion: The Core Service receives an
.mp4and saves it instantly to a shared local Docker volume (/shared). - Event Publishing: A
video.uploadedKafka event is emitted containing the locallocal:///shared/filename.mp4path. - Transcoding: The Video Worker consumes the event, grabs the file instantly from disk, and runs an optimized FFMPEG command:
-preset veryfast: Ensures milliseconds processing time.-g 48 -keyint_min 48 -sc_threshold 0: Forces keyframes every 2 seconds, which is absolutely critical for preventing HLS players from stalling or endlessly buffering.-hls_time 4: Creates small, 4-second chunks so the browser starts playing almost instantly.
- Cloud Sync: The finalized multi-bitrate HLS streams are uploaded to Azure Blob Storage (which has CORS programmatically configured to allow frontend fetches).
- Cleanup & Notification: The local
.mp4is deleted to conserve server disk space, and avideo.transcodedKafka event is sent back to the Core Service to update the database with the public Azure.m3u8URL.
- Docker & Docker Compose (V2+)
- Node.js (v18+)
- Go (1.21+)
- Azure Blob Storage Account credentials (or Azurite Emulator). Ensure CORS is configured to allow
GETandOPTIONSfrom*orlocalhost:3005.
The entire backend infrastructure, including databases and all Go microservices, is orchestrated via Docker Compose.
cd lms-api-gateway
# Ensure the .env file exists with valid POSTGRES and AZURE credentials
docker-compose up -d --buildYou can run docker-compose logs -f lms-video-worker to watch the FFMPEG pipeline in action when you upload a video.
cd lms-frontend
npm install
npm run devThe Next.js application will compile and be accessible at http://localhost:3005.
- Go Code: Ensure all Go code is formatted using
gofmtand follows idiomatic Go practices. Avoid unnecessary comments unless documenting complex business logic. - Frontend Code: Strictly adhere to the "Ada Aesthetic". Utilize Tailwind utility classes, maintain high contrast ratios, and use brutalist design principles (sharp corners, solid borders).
This project is proprietary and confidential. All rights reserved.