How mitodl/mit-learn works
Main Components
a. Frontend Layer:
• Next.js application (in /frontends/main)
• Component library (in /frontends/ol-components)
• API client layer (in /frontends/api)
• Storybook for component documentation
b. Backend Layer:
• Django REST Framework application
• Multiple Django apps for different features:
• learning_resources
• authentication
• profiles
• channels
• news_events
• vector_search
• ai_chat
c. Data Storage:
• PostgreSQL database
• OpenSearch for search functionality
• S3 for media storage
• Redis for caching
d. External Services:
• Keycloak for OpenID Connect authentication
• Mailgun for email services
• PostHog for analytics and feature flags
• Various MIT learning platforms (xpro, OCW, etc.)
Integration Points
• Frontend to Backend API communication
• Backend to Database interactions
• Authentication flow with Keycloak
• ETL pipelines from external learning platforms
• Search queries to OpenSearch
• File uploads to S3
• Email sending via Mailgun
• Analytics data to PostHog
Key Architectural Patterns
Highlight:
• Microservices-like structure with distinct Django apps
• ETL pipeline architecture for data ingestion
• REST API design with OpenAPI specification
• Component-based frontend architecture
• Event-driven architecture for certain features
• Caching strategy with Redis
Specific Implementation Details
• Celery task queue for background processing
• Docker containerization structure
• OpenSearch cluster configuration
• Frontend state management
• API versioning (v0 and v1)
Development Environment
Show:
• Docker Compose setup
• Local development services
• Codespaces configuration
• Testing infrastructure
┌─────────────────────────────────────────────────────────────┐
• Client Layer │
• (Next.js, React Components, API Client, Frontend Routing) │
• ┤
• API Gateway │
• (Django REST Framework, OpenAPI, Authentication) │
• ┤
• Service Layer │
• (Django Apps, Business Logic, ETL Pipelines) │
• ┤
• Data Layer │
• (PostgreSQL, OpenSearch, Redis, S3) │
• ┤
• External Services │
• (Keycloak, Mailgun, PostHog, MIT Learning Platforms) │
• ┘
• Blue for frontend components
• Green for backend services
• Yellow for databases and storage
• Purple for external services
• Red for security components
• Gray for development/infrastructure components
• Environment boundaries