Skip to content

Online Learning App System Design

1. Business Requirements

Functional Requirements

  • User registration and authentication (students, instructors, admins)
  • Course creation, editing, and publishing by instructors
  • Enrollments and progress tracking for students
  • Video lectures, quizzes, assignments, and downloadable resources
  • Real-time and scheduled notifications/alerts (urgent deadlines, announcements)
  • Discussion forums and messaging
  • Mobile-ready responsive UI and API
  • Analytics and reporting (student progress, course trends)
  • Role-based access control
  • Certificate generation upon course completion

Non-Functional Requirements

  • 99.9% availability (max ~8.76 hours downtime/year)
  • Scalability to support thousands of concurrent users
  • Secure data storage and access control
  • Fast response times (<300ms for most requests)
  • Audit logging and monitoring
  • Backup and disaster recovery
  • GDPR/data privacy compliance
  • Mobile responsiveness

Out of Scope

  • In-person class scheduling
  • Integration with external payment gateways (unless specified)
  • Built-in video conferencing (unless specified)

2. Estimation & Back-of-the-Envelope Calculations

  • Users: 100,000 students, 2,000 instructors, 100 admins
  • Courses: 10,000
  • Daily transactions: ~50,000 (logins, enrollments, video views, alerts)
  • Peak concurrent users: ~5,000
  • Data size:
    • User data: 102,100 × 2 KB ≈ 200 MB
    • Courses: 10,000 × 5 KB ≈ 50 MB
    • Videos/resources: 10,000 × 500 MB ≈ 5 TB (object storage)
    • Progress/grades: 1M × 0.5 KB ≈ 500 MB
    • Audit logs: 10M × 0.2 KB ≈ 2 GB
    • Total DB size: ~1 GB (excluding logs, backups, media)
  • Availability:
    • 99.9% = 8.76 hours/year downtime max
    • Use managed DB, multi-AZ deployment, health checks, auto-scaling

3. High Level Design (Mermaid Diagrams)

Component Diagram

mermaid
flowchart LR
  User[User (Web/Mobile)]
  LB[Load Balancer]
  App[Application Server]
  DB[(Database)]
  Cache[Cache (Redis)]
  Storage[Object Storage (Videos/Resources)]
  Alert[Alert/Notification Service]
  Analytics[Analytics Engine]

  User --> LB --> App
  App --> DB
  App --> Cache
  App --> Storage
  App --> Alert
  App --> Analytics
  Analytics --> DB

Data Flow Diagram

mermaid
sequenceDiagram
  participant U as User
  participant A as App Server
  participant D as Database
  participant C as Cache
  participant S as Storage
  participant L as Alert Service

  U->>A: Submit Assignment
  A->>C: Check Enrollment/Progress
  C-->>A: Hit/Miss
  A->>D: Update Progress/Grade
  D-->>A: Success/Fail
  A->>S: Store Assignment (if file)
  S-->>A: Success/Fail
  A->>L: Send Urgent Alert (if deadline)
  A-->>U: Response

Key Design Decisions

  • Database: Relational DB (e.g., PostgreSQL) for transactional data, strong consistency
  • Cache: Redis for fast lookups (sessions, enrollments, progress)
  • Object Storage: For videos/resources (e.g., AWS S3, Azure Blob)
  • Analytics: Batch or streaming (e.g., Kafka + Spark, or managed cloud analytics)
  • Deployment: Cloud-based, multi-AZ, managed services for high availability
  • Alerting/Notifications: Email/SMS/push via third-party service (e.g., Twilio, Firebase)
  • API: REST/GraphQL for mobile and web clients

4. Conceptual Design

Entities

  • User: id, name, email, password_hash, role, registration_date, status
  • Course: id, instructor_id, title, description, category, status, created_at, updated_at
  • Enrollment: id, user_id, course_id, enrolled_at, progress, grade, status
  • Lecture: id, course_id, title, video_url, resources, order, duration
  • Assignment: id, course_id, title, description, due_date, max_score
  • Submission: id, assignment_id, user_id, file_url, score, submitted_at, graded_at
  • Discussion: id, course_id, user_id, message, created_at
  • Alert: id, user_id, type (urgent/deadline/announcement), message, created_at, status
  • Certificate: id, user_id, course_id, issued_at, url
  • AuditLog: id, user_id, action, entity, entity_id, timestamp

Key Flows

  • Assignment Submission:
    1. User submits assignment
    2. App checks enrollment/progress (cache, then DB)
    3. Stores submission, updates progress/grade
    4. Sends urgent alert if deadline is near/missed
  • Course Publishing:
    1. Instructor creates/edits course
    2. App stores course, uploads videos/resources
    3. Notifies enrolled students
  • Alerts:
    • System triggers urgent alerts for deadlines, announcements
  • Analytics:
    • Periodic jobs aggregate progress, engagement, and trends

Security

  • Role-based access control (RBAC)
  • Input validation, rate limiting
  • Encrypted connections (HTTPS)
  • Regular backups and audit logs

5. Bottlenecks and Refinement

Potential Bottlenecks

  • Video/resource storage/delivery:
    • Use scalable object storage and CDN for media
  • Database contention:
    • Use read replicas, caching, and DB connection pooling
  • Alert delivery:
    • Use async queues for urgent notifications
  • Analytics workload:
    • Offload to separate analytics engine, run during off-peak
  • Single region failure:
    • Deploy across multiple availability zones/regions

Refinement

  • Monitor system metrics and auto-scale app servers
  • Regularly test failover and backup restores
  • Optimize queries and indexes for frequent operations
  • Consider sharding if user/course/assignment volume grows significantly

This design provides a scalable, highly available, and mobile-ready online learning system with robust urgent alerts, analytics, and operational best practices.