A modern, scalable Learning Management System built with FastAPI, Streamlit, MongoDB, Docker, and Kubernetes.
- Backend: Python FastAPI with Pydantic v2
- Frontend: Streamlit web application
- Database: MongoDB with Beanie ODM
- Containerization: Docker + Docker Compose (local) + Kubernetes (production)
- Cloud: Linode Kubernetes Engine (LKE) + MongoDB Atlas
- Infrastructure as Code: Terraform
- CI/CD: GitHub Actions
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend β β Load Balancer β β LKE Cluster β
β (Streamlit) βββββΊβ (Linode) βββββΊβ (FastAPI) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β MongoDB Atlas β
β (Database) β
βββββββββββββββββββ
- Python 3.11+
- Docker & Docker Compose
- kubectl (for Kubernetes)
- Terraform (for infrastructure)
- Linode CLI configured
- MongoDB Atlas account
-
Clone the repository
git clone <repository-url> cd ScottLMS
-
Start with Docker Compose
# Start all services make docker-start # Or manually docker-compose up -d
-
Access the application
- Frontend: http://localhost:8501
- API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- MongoDB Express: http://localhost:8081 (admin/admin)
# View all available commands
make help
# Start development environment
make docker-start
# View logs
make docker-logs
# Stop development environment
make docker-stop
# Restart services
make docker-restart
# Run tests
make test
# Run backend tests only
make test-backend
# Run frontend tests only
make test-frontend
# Run tests with coverage
make test-coverage
# Test with Docker (using latest images)
make docker-test-backend
make docker-test-frontend
make docker-test-all
# Test with specific Docker tag
TAG=v1.0.0 make docker-test-allScottLMS/
βββ backend/ # FastAPI backend application
β βββ entities/ # Pydantic models and Beanie documents
β β βββ users.py # User model
β β βββ courses.py # Course model
β β βββ enrollments.py # Enrollment model
β βββ routers/ # API routes and endpoints
β β βββ users.py # User endpoints
β β βββ courses.py # Course endpoints
β β βββ enrollments.py # Enrollment endpoints
β βββ tests/ # Backend tests
β β βββ test_database.py
β β βββ test_main.py
β β βββ test_entities.py
β β βββ test_routers.py
β βββ database.py # Database connection and initialization
β βββ main.py # FastAPI application entry point
β βββ requirements.txt # Backend dependencies
β βββ Dockerfile # Backend Docker image
βββ frontend/ # Streamlit frontend application
β βββ components/ # Reusable UI components
β β βββ auth/ # Authentication components
β β βββ courses/ # Course-related components
β β βββ enrollments/ # Enrollment components
β β βββ users/ # User management components
β β βββ shared/ # Shared components
β βββ pages/ # Streamlit pages
β β βββ 1_Dashboard.py
β β βββ 2_Users.py
β β βββ 3_Courses.py
β β βββ 4_Enrollments.py
β βββ tests/ # Frontend tests
β β βββ test_components.py
β β βββ test_pages.py
β β βββ test_frontend_config.py
β βββ Home.py # Main Streamlit application
β βββ config.py # Frontend configuration
β βββ requirements.txt # Frontend dependencies
β βββ Dockerfile # Frontend Docker image
βββ terraform/ # Infrastructure as Code
β βββ main.tf # Main Terraform configuration
β βββ variables.tf # Variable definitions
β βββ outputs.tf # Output definitions
β βββ kubernetes.tf # Kubernetes resources
β βββ terraform.tfvars # Variable values
βββ .github/ # GitHub Actions workflows
β βββ workflows/
β βββ pr-validation.yml # PR validation pipeline
βββ scripts/ # Utility scripts
β βββ mongo-init-local.js # MongoDB initialization
βββ docker-compose.yml # Local development setup
βββ Makefile # Development commands
βββ README.md # This file
| Variable | Description | Default |
|---|---|---|
MONGODB_URL |
MongoDB connection string | mongodb://localhost:27017/scottlms |
SECRET_KEY |
JWT secret key | your-secret-key-change-in-production |
ENVIRONMENT |
Environment (development/production) | development |
LOG_LEVEL |
Logging level | info |
API_V1_STR |
API version prefix | /api/v1 |
- Create a MongoDB Atlas account
- Create a new project
- Create a cluster (M10 or higher for production)
- Create a database user
- Whitelist your IP addresses
- Get the connection string
POST /api/users/- Create userGET /api/users/- List usersGET /api/users/{id}- Get userPUT /api/users/{id}- Update userDELETE /api/users/{id}- Delete user
POST /api/courses/- Create courseGET /api/courses/- List coursesGET /api/courses/{id}- Get coursePUT /api/courses/{id}- Update courseDELETE /api/courses/{id}- Delete course
POST /api/enrollments/- Create enrollmentGET /api/enrollments/- List enrollmentsGET /api/enrollments/{id}- Get enrollmentPUT /api/enrollments/{id}- Update enrollmentDELETE /api/enrollments/{id}- Delete enrollment
Visit /docs when running the application for Swagger UI documentation.
# Run all tests
make test
# Run backend tests only
make test-backend
# Run frontend tests only
make test-frontend
# Run tests with coverage
make test-coverage# Test with latest Docker images
make docker-test-backend
make docker-test-frontend
make docker-test-all
# Test with specific tag
TAG=v1.0.0 make docker-test-all- Backend Tests: Unit tests for API endpoints, database operations, and Pydantic models
- Frontend Tests: Component tests and page functionality tests
- Integration Tests: End-to-end testing with Docker containers
# Start all services
make docker-start
# View logs
make docker-logs
# Stop services
make docker-stop
# Rebuild and restart
make docker-rebuild-
Infrastructure Setup
cd terraform terraform init terraform plan terraform apply -
Application Deployment
# Build and push images make docker-build make docker-push # Deploy using Terraform cd terraform && terraform apply -auto-approve
- β All dependencies updated to latest secure versions
- β 5 critical vulnerabilities fixed (PyMongo, FastAPI, Requests)
- β Pydantic v2 migration completed
- β Deprecation warnings resolved
- JWT-based authentication (planned)
- Role-based access control (student, instructor, admin)
- Password hashing with bcrypt
- Input validation with Pydantic v2
- Security scanning in CI/CD pipeline
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
make test) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- All PRs are automatically validated with GitHub Actions
- Tests must pass before merging
- Security scanning is performed on all changes
- Docker images are built and tested with PR-specific tags
- Application health:
/health - Kubernetes liveness/readiness probes configured
- Structured logging with JSON format
- Log levels: DEBUG, INFO, WARNING, ERROR, CRITICAL
- PR Validation: Terraform validation, Docker builds, tests, security scans
- Automated Testing: Backend and frontend tests with Docker
- Security Scanning: Trivy vulnerability scanning
- Docker Tagging: PR-specific image tags for testing
- Backend API with FastAPI
- Frontend with Streamlit
- MongoDB integration with Beanie
- Docker containerization
- Kubernetes deployment
- CI/CD pipeline
- Security vulnerability fixes
- Authentication & authorization
- File upload for course materials
- Real-time notifications
- Analytics and reporting
- Advanced course features (quizzes, assignments)
- Integration with external services
This project is licensed under the MIT License - see the LICENSE file for details.
For support, email support@scottlms.com or create an issue in the repository.
ScottLMS - A modern learning management system built with cutting-edge technologies.