Momentum LMS Architecture
Welcome to the Momentum Learning Management Platform architecture documentation. This interactive guide provides visual representations of our AWS-powered infrastructure, designed to deliver bite-sized courses with AI-generated content.
- Frontend Layer (Next.js + Amplify)
- API Layer (REST API Gateway)
- Backend Services (Lambda + Step Functions)
- Database & Caching
- Users & Authentication
- Courses & Lessons
- Enrollments & Progress
- Payments & Reviews
- GitHub Actions CI/CD
- Terraform Infrastructure
- Amplify Auto-Deploy
- Smoke Tests & Monitoring
- Course Outline Generation
- Parallel Lesson Creation
- Video Script & Generation
- Content Storage & Publishing
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | Next.js 14 + TypeScript | Server-side rendered React application |
| Hosting | AWS Amplify Hosting | CDN + SSR hosting with auto-deploy |
| API | AWS API Gateway (REST) | RESTful API with Cognito authorization |
| Auth | AWS Cognito | User authentication + social login |
| Compute | AWS Lambda + ECS Fargate | Serverless functions + containers |
| Database | Aurora Serverless v2 (PostgreSQL) | Auto-scaling relational database |
| Cache | ElastiCache Serverless (Redis) | Session storage and query caching |
| Storage | Amazon S3 | Media and content storage |
| AI | Amazon Bedrock (Claude) | AI content generation |
| Payments | Stripe | Payment processing |
System Architecture
High-level visualization of the Momentum LMS architecture showing all major AWS services, external integrations, and data flow between components.
Primary User Flow
AI Content Generation Flow
Payment Flow
- Next.js 14 - React framework with SSR
- Amplify CDN - Global content delivery
- TypeScript - Type-safe development
- API Gateway - REST API endpoints
- Cognito Authorizer - JWT token validation
- Lambda Integration - Business logic handlers
- Lambda - Serverless compute
- Step Functions - AI workflow orchestration
- ECS Fargate - Video processing containers
- Aurora Serverless v2 - PostgreSQL database
- ElastiCache - Redis caching
- S3 - Object storage
Database Schema
Entity-relationship diagram showing the PostgreSQL database structure for the Momentum LMS platform, including users, courses, enrollments, and progress tracking.
- Roles: FREE, PREMIUM, ADMIN
- Social login support
- JSONB preferences
- Rich content (markdown/HTML)
- Video content support
- Action items & resources
- Time spent tracking
- Completion status
- User notes support
- Stripe subscription support
- Refund tracking
- 1-5 star ratings
| Table | Row Size | Est. Rows (Year 1) | Growth Rate |
|---|---|---|---|
| users | 1-2 KB | 10,000-50,000 | ~1,000/month |
| categories | 500 bytes | 20-50 | ~2-3/year |
| courses | 3-5 KB | 100-500 | ~20-50/month |
| lessons | 5-20 KB | 1,500-10,000 | ~300-700/month |
| enrollments | 1-2 KB | 50,000-200,000 | ~5,000-10,000/month |
| progress | 500 bytes | 700,000-2,800,000 | ~70,000-140,000/month |
| payments | 500 bytes | 10,000-50,000 | ~1,000-5,000/month |
| badges/user_badges | 500 bytes | 150,000-750,000 | ~15,000-75,000/month |
| course_generation_jobs | 2-5 KB | 500-2,000 | ~50-200/month |
| pdf_reference_documents | 1-2 KB | 100-500 | ~10-50/month |
| lesson_video_script | 2-5 KB | 1,500-10,000 | ~300-700/month |
Deployment Pipeline
CI/CD pipeline visualization showing the complete deployment process from code commit to production, including automated testing, infrastructure updates, and rollback procedures.
- ESLint code linting
- TypeScript type checking
- Jest unit tests
- Playwright E2E tests
- Terraform infrastructure updates
- Amplify auto-deploy
- CDN cache invalidation
- Smoke tests verification
- Smoke test failure triggers
- Error rate > 1% alarm
- P95 latency > 2s alarm
- Health check failures
- CloudWatch dashboards
- Slack notifications
- Incident creation
- Deployment metrics
| Property | Value |
|---|---|
| Environment | Production (Single environment for MVP) |
| Domain | momentum.cloudnnj.com |
| Region | us-east-1 (N. Virginia) |
| Branch Strategy | Trunk-based development (main branch) |
| Deployment Frequency | ~10 deploys/week |
| Build Time | 5-10 minutes |
| Rollback Time | 2-5 minutes |
| Availability Target | 99.9% |
AI Content Generation Workflow
AWS Step Functions workflow for automated course content generation using Amazon Bedrock (Claude) for text content and third-party APIs for video generation.
- Execution Type: Step Functions Express
- Duration: 15-45 minutes
- Parallelization: Up to 10 concurrent lessons
- Success Rate Target: >95%
- Model: Claude 3 Sonnet (Bedrock)
- Content: Lesson text generation
- Scripts: Video narration scripts
- Cost: $0.02-0.05 per lesson
- Primary: HeyGen API
- Avatar: Configurable AI presenters
- Storage: Direct to S3
- Output: MP4 video files
- Bedrock: $0.50-0.70 per course
- HeyGen: ~$10-15 per video
- AWS Services: $5-10 per course
- Total (14-day): ~$150-250
1. Initialize Workflow
Validates course data, checks for DRAFT status, and prepares workflow state with metrics tracking.
2. Generate Outline
Amazon Bedrock (Claude) creates a structured course outline with lesson titles, learning outcomes, and topics for each day.
3. Parallel Lesson Processing
Step Functions Map State generates all lessons simultaneously (max 10 concurrent). Each lesson goes through content generation, video script creation, and video API submission.
4. Video Processing (Async)
Videos are processed asynchronously via SQS queue. Lambda workers poll HeyGen API status every 60 seconds, download completed videos to S3, and update the database with video URLs.
5. Completion & Notification
Results are aggregated, course status updated, and admin notified via SNS + SES with review link and generation summary.
Color Legend & Conventions
Reference guide for colors, shapes, and symbols used throughout the architecture diagrams.
#3B82F6
#10B981
#F59E0B
#8B5CF6
#EF4444
#EC4899
#14B8A6
#F97316
| Element | Meaning |
|---|---|
| Rectangles | Services and components |
| Cylinders | Databases and data stores |
| Clouds | External services and APIs |
| Diamonds | Decision points |
| Solid arrows | Synchronous calls / data flow |
| Dashed arrows | Async / event-driven communication |
| Bold arrows | Primary user flows |