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.

4
Architecture Diagrams
15+
AWS Services
13
Database Migrations
~85%
MVP Complete
System Architecture
High-level visualization showing all major AWS services, external integrations, and data flow between components.
  • Frontend Layer (Next.js + Amplify)
  • API Layer (REST API Gateway)
  • Backend Services (Lambda + Step Functions)
  • Database & Caching
Database Schema
Entity-relationship diagram showing all database tables, their relationships, and key attributes.
  • Users & Authentication
  • Courses & Lessons
  • Enrollments & Progress
  • Payments & Reviews
Deployment Pipeline
CI/CD pipeline visualization from code commit to production deployment with automated testing and rollback.
  • GitHub Actions CI/CD
  • Terraform Infrastructure
  • Amplify Auto-Deploy
  • Smoke Tests & Monitoring
AI Workflow
Step Functions workflow for AI-powered course content generation using Amazon Bedrock and video APIs.
  • Course Outline Generation
  • Parallel Lesson Creation
  • Video Script & Generation
  • Content Storage & Publishing
Tech Stack Overview
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.

Frontend
API Layer
Backend
Database
Storage
AI/ML
Auth/Security
External
Loading diagram...
Data Flow Overview

Primary User Flow

User → CDN → Next.js App → API Gateway → Lambda → Aurora ↓ Cognito Auth

AI Content Generation Flow

Admin → API Gateway → Step Functions → Bedrock → S3 → HeyGen API → S3 (video storage)

Payment Flow

User → Next.js → Stripe → API Gateway → Lambda → Aurora → SQS → Email
Frontend Layer
  • Next.js 14 - React framework with SSR
  • Amplify CDN - Global content delivery
  • TypeScript - Type-safe development
API Layer
  • API Gateway - REST API endpoints
  • Cognito Authorizer - JWT token validation
  • Lambda Integration - Business logic handlers
Backend Services
  • Lambda - Serverless compute
  • Step Functions - AI workflow orchestration
  • ECS Fargate - Video processing containers
Data Layer
  • 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.

Loading diagram...
👤
Users
User profiles synchronized from Cognito with preferences and subscription information.
  • Roles: FREE, PREMIUM, ADMIN
  • Social login support
  • JSONB preferences
📚
Courses & Lessons
Course content with 7, 14, or 21-day durations and daily lessons.
  • Rich content (markdown/HTML)
  • Video content support
  • Action items & resources
📈
Progress Tracking
Detailed tracking of user progress through courses and lessons.
  • Time spent tracking
  • Completion status
  • User notes support
💳
Payments & Reviews
Stripe-integrated payments and verified purchase reviews.
  • Stripe subscription support
  • Refund tracking
  • 1-5 star ratings
Table Details & Row Estimates
Table Row Size Est. Rows (Year 1) Growth Rate
users1-2 KB10,000-50,000~1,000/month
categories500 bytes20-50~2-3/year
courses3-5 KB100-500~20-50/month
lessons5-20 KB1,500-10,000~300-700/month
enrollments1-2 KB50,000-200,000~5,000-10,000/month
progress500 bytes700,000-2,800,000~70,000-140,000/month
payments500 bytes10,000-50,000~1,000-5,000/month
badges/user_badges500 bytes150,000-750,000~15,000-75,000/month
course_generation_jobs2-5 KB500-2,000~50-200/month
pdf_reference_documents1-2 KB100-500~10-50/month
lesson_video_script2-5 KB1,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.

Loading diagram...
CI Pipeline
Continuous integration with automated quality checks.
  • ESLint code linting
  • TypeScript type checking
  • Jest unit tests
  • Playwright E2E tests
🚀
CD Pipeline
Continuous deployment to production environment.
  • Terraform infrastructure updates
  • Amplify auto-deploy
  • CDN cache invalidation
  • Smoke tests verification
Rollback Strategy
Automated rollback on failure detection.
  • Smoke test failure triggers
  • Error rate > 1% alarm
  • P95 latency > 2s alarm
  • Health check failures
📊
Monitoring
Real-time deployment monitoring and alerts.
  • CloudWatch dashboards
  • Slack notifications
  • Incident creation
  • Deployment metrics
Environment Details
PropertyValue
EnvironmentProduction (Single environment for MVP)
Domainmomentum.cloudnnj.com
Regionus-east-1 (N. Virginia)
Branch StrategyTrunk-based development (main branch)
Deployment Frequency~10 deploys/week
Build Time5-10 minutes
Rollback Time2-5 minutes
Availability Target99.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.

Loading diagram...
Workflow Overview
  • Execution Type: Step Functions Express
  • Duration: 15-45 minutes
  • Parallelization: Up to 10 concurrent lessons
  • Success Rate Target: >95%
🤖
AI Generation
  • Model: Claude 3 Sonnet (Bedrock)
  • Content: Lesson text generation
  • Scripts: Video narration scripts
  • Cost: $0.02-0.05 per lesson
🎥
Video Generation
  • Primary: HeyGen API
  • Avatar: Configurable AI presenters
  • Storage: Direct to S3
  • Output: MP4 video files
💰
Cost Breakdown
  • Bedrock: $0.50-0.70 per course
  • HeyGen: ~$10-15 per video
  • AWS Services: $5-10 per course
  • Total (14-day): ~$150-250
Workflow Process Details

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.

Frontend Components
#3B82F6
User interface, Next.js app, CDN, static assets, browser interactions.
API Layer
#10B981
API Gateway REST endpoints, Cognito authorizers, request validation.
Backend Services
#F59E0B
Lambda functions, Step Functions, ECS Fargate, SQS, EventBridge.
Databases
#8B5CF6
Aurora PostgreSQL, ElastiCache Redis, OpenSearch, data stores.
External Services
#EF4444
Stripe payments, third-party APIs, external integrations.
Auth/Security
#EC4899
Cognito, OAuth providers, Secrets Manager, security components.
Storage
#14B8A6
S3 buckets, file storage, media content, CloudFront CDN.
AI/ML Services
#F97316
Amazon Bedrock (Claude), HeyGen video generation, AI workflows.
Shape & Line Conventions
ElementMeaning
RectanglesServices and components
CylindersDatabases and data stores
CloudsExternal services and APIs
DiamondsDecision points
Solid arrowsSynchronous calls / data flow
Dashed arrowsAsync / event-driven communication
Bold arrowsPrimary user flows