Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

75 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ScottLMS - Learning Management System

A modern, scalable Learning Management System built with FastAPI, Streamlit, MongoDB, Docker, and Kubernetes.

πŸ—οΈ Architecture

Tech Stack

  • 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

System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚   Load Balancer β”‚    β”‚   LKE Cluster   β”‚
β”‚   (Streamlit)   │◄──►│   (Linode)      │◄──►│   (FastAPI)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                        β”‚
                                                        β–Ό
                                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                               β”‚ MongoDB Atlas   β”‚
                                               β”‚   (Database)    β”‚
                                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

  • Python 3.11+
  • Docker & Docker Compose
  • kubectl (for Kubernetes)
  • Terraform (for infrastructure)
  • Linode CLI configured
  • MongoDB Atlas account

Local Development

  1. Clone the repository

    git clone <repository-url>
    cd ScottLMS
  2. Start with Docker Compose

    # Start all services
    make docker-start
    
    # Or manually
    docker-compose up -d
  3. Access the application

Development Commands

# 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-all

πŸ“ Project Structure

ScottLMS/
β”œβ”€β”€ 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

πŸ”§ Configuration

Environment Variables

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

MongoDB Atlas Setup

  1. Create a MongoDB Atlas account
  2. Create a new project
  3. Create a cluster (M10 or higher for production)
  4. Create a database user
  5. Whitelist your IP addresses
  6. Get the connection string

πŸ“š API Documentation

Core Endpoints

Users

  • POST /api/users/ - Create user
  • GET /api/users/ - List users
  • GET /api/users/{id} - Get user
  • PUT /api/users/{id} - Update user
  • DELETE /api/users/{id} - Delete user

Courses

  • POST /api/courses/ - Create course
  • GET /api/courses/ - List courses
  • GET /api/courses/{id} - Get course
  • PUT /api/courses/{id} - Update course
  • DELETE /api/courses/{id} - Delete course

Enrollments

  • POST /api/enrollments/ - Create enrollment
  • GET /api/enrollments/ - List enrollments
  • GET /api/enrollments/{id} - Get enrollment
  • PUT /api/enrollments/{id} - Update enrollment
  • DELETE /api/enrollments/{id} - Delete enrollment

Interactive API Documentation

Visit /docs when running the application for Swagger UI documentation.

πŸ§ͺ Testing

Local Testing

# 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

Docker Testing

# 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

Test Structure

  • 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

πŸš€ Deployment

Local Development

# Start all services
make docker-start

# View logs
make docker-logs

# Stop services
make docker-stop

# Rebuild and restart
make docker-rebuild

Production Deployment

  1. Infrastructure Setup

    cd terraform
    terraform init
    terraform plan
    terraform apply
  2. Application Deployment

    # Build and push images
    make docker-build
    make docker-push
    
    # Deploy using Terraform
    cd terraform && terraform apply -auto-approve

πŸ”’ Security

Recent Security Updates

  • βœ… All dependencies updated to latest secure versions
  • βœ… 5 critical vulnerabilities fixed (PyMongo, FastAPI, Requests)
  • βœ… Pydantic v2 migration completed
  • βœ… Deprecation warnings resolved

Security Features

  • 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

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests (make test)
  5. Commit your changes (git commit -m 'Add some amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Development Workflow

  • 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

πŸ“Š Monitoring

Health Checks

  • Application health: /health
  • Kubernetes liveness/readiness probes configured

Logging

  • Structured logging with JSON format
  • Log levels: DEBUG, INFO, WARNING, ERROR, CRITICAL

CI/CD Pipeline

  • 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

πŸ—ΊοΈ Roadmap

  • 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

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

For support, email support@scottlms.com or create an issue in the repository.


ScottLMS - A modern learning management system built with cutting-edge technologies.

About

A learning management system that uses a bunch of cool technologies.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages