Skip to content

robert-7/course-enrollment-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Course Enrollment App

CI codecov

Python Flask MongoDB Docker

A full-stack Flask web application for course enrollment with user authentication, MongoDB-backed data models, REST APIs with Swagger docs, and a fully containerized Docker Compose setup.

App Walkthrough

Quick Start

Make sure Docker is installed, then run:

make run

The app will be available at http://localhost:5000. The Swagger API docs are at http://localhost:5000/api/v1/docs.

Local Docker runs can leave APP_ENV unset, which defaults to development. HTTPS deployments on AWS must set APP_ENV=production so Flask marks session cookies as Secure. FLASK_DEBUG=true is for local Docker only and must never be set for production deployments. The production image now serves the app with Gunicorn, while docker-compose.yaml keeps make run on flask run for local development.

To tear everything down:

make clean

Other useful commands:

Command Description
make setup Generate .env with a random SECRET_KEY (first-time setup)
make run Build and start all containers
make test Run the test suite inside the Flask container
make seed Re-seed the database with course data
make lint Run linters via pre-commit
make clean Tear down containers and volumes

Contributing

See CONTRIBUTING.md for environment setup, linting, Postman, and other developer instructions.

E2E Testing (Playwright)

This repo includes an automated UI walkthrough test: e2e/ui-walkthrough.spec.js.

Quick run (Docker-only, no local npm install needed):

docker compose up -d --build
docker compose run --rm e2e-tests

Equivalent Make command:

make e2e-docker

Local Playwright run (if you want to run from host machine):

npm install
npx playwright install chromium
docker compose up -d --build
npm run e2e:walkthrough

For full details, see TESTING.md.

Features

  • User registration & login -- session-based auth with hashed passwords (Werkzeug)
  • Course catalog -- browse courses pulled from MongoDB, filterable by term
  • Course enrollment -- enroll in courses with duplicate-enrollment protection, CSRF-protected form
  • Enrollment dashboard -- view your enrolled courses via MongoDB aggregation
  • REST API -- authenticated course endpoints at /api/v1/courses with Swagger UI docs (flask-restx)
  • Dockerized stack -- Flask, MongoDB, and seed data orchestrated via Docker Compose
  • CI/CD -- GitHub Actions workflows with pre-commit linting (flake8, markdownlint)

Please see the testing documentation that showcases an end-to-end demo of features supported.

Architecture

The app runs as three Docker Compose services:

Service Description
course-enrollment-app Python/Flask web server on port 5000
mongodb MongoDB 8.2 database with persistent volume
mongo-seed One-shot container that imports course data on first run
Browser :5000 ──► course-enrollment-app ──► mongodb :27017
                                   ▲
                              mongo-seed
                          (imports courses.json)

The Flask app follows a single-module structure under application/.

Acknowledgments

This project was originally based on the LinkedIn Learning course "Full Stack Web Development with Flask". It has since been extended with Docker containerization, CI/CD pipelines, rebranded course data, and additional tooling.

About

A Flask course enrollment app with secure authentication, MongoDB-backed data models, documented REST APIs, and a live AWS deployment managed with AWS CDK.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors