✅ Module 14 – BREAD Functionality for Calculations (FastAPI + Docker + CI/CD)
This project implements full BREAD (Browse, Read, Edit, Add, Delete) functionality for user-based calculations using FastAPI, PostgreSQL, SQLAlchemy, Pydantic, Docker, and GitHub Actions CI/CD. It also includes a working frontend, Playwright E2E tests, and an automated Docker Hub deployment pipeline.
🚀 Features Implemented ✅ Backend (FastAPI)
Browse – View all calculations for the logged-in user
Read – Fetch a single calculation by ID
Edit – Update an existing calculation
Add – Create a new calculation (Add, Subtract, Multiply, Divide)
Delete – Remove a calculation safely
Each calculation is linked to a user using foreign keys and protected with JWT authentication.
✅ Frontend
Forms for:
Creating calculations
Viewing all calculations
Editing calculations
Deleting calculations
Client-side input validation:
Numeric validation
Valid operation selection
✅ Testing
Unit Tests – Core logic testing
Integration Tests – Database + API testing
Playwright E2E Tests – Full frontend & backend workflow
Tests run automatically through GitHub Actions CI
✅ CI/CD Pipeline
Automated:
Dependency install
Unit + Integration + E2E Tests
Docker image build
Security scan (Trivy)
Auto-push to Docker Hub on success
🐳 Docker Hub Image
Your project image is available at:
https://hub.docker.com/r/arhamidrees63/module13
(Updated automatically after each successful CI/CD pipeline run.)
⚙️ How to Run This Project Locally ✅ Step 1: Clone the Repository git clone git@github.com:arhamidrees63/assignment14.git cd assignment14
✅ Step 2: Create Virtual Environment python -m venv venv source venv/bin/activate
✅ Step 3: Install Dependencies pip install --upgrade pip pip install -r requirements.txt playwright install
✅ Step 4: Run with Docker Compose docker-compose up --build
✅ Step 5: Access the App Service URL FastAPI API http://localhost:8000
API Docs http://localhost:8000/docs
Frontend http://localhost:8000 🧪 Running Tests Locally pytest tests/unit/ pytest tests/integration/ pytest tests/e2e/
🔐 Authentication
JWT-based login system
Tokens stored securely in browser
User-specific calculations only
✅ Module 14 Requirements Covered Requirement Status BREAD Endpoints ✅ Implemented Frontend Integration ✅ Done Playwright Tests ✅ Complete CI/CD Pipeline ✅ Working Docker Hub Deployment ✅ Live User-Specific Calculations ✅ Linked with FK Readme & Reflection ✅ Included 📝 Reflection Document
A full reflection covering:
Database & Pydantic learning
Testing & CI/CD experience
Factory pattern usage
Key challenges & solutions is included in this project as required.