Skip to content

Latest commit

Β 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ TaskFlow β€” Team Task Management Platform

A lightweight team task management platform (think Trello-lite) built to demonstrate Continuous Integration (CI) in DevOps. TaskFlow showcases a realistic full-stack project with automated testing, Docker containerisation, and a GitHub Actions CI pipeline.


πŸ“ Architecture

taskflow-project/
β”œβ”€β”€ backend/                  # FastAPI + SQLite + SQLAlchemy
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ main.py           # App entry point & CORS config
β”‚   β”‚   β”œβ”€β”€ models.py         # SQLAlchemy ORM models
β”‚   β”‚   β”œβ”€β”€ database.py       # DB connection & session factory
β”‚   β”‚   β”œβ”€β”€ schemas.py        # Pydantic request/response schemas
β”‚   β”‚   β”œβ”€β”€ crud.py           # Database operations
β”‚   β”‚   └── routes/
β”‚   β”‚       β”œβ”€β”€ users.py      # Auth endpoints (register, login)
β”‚   β”‚       └── tasks.py      # Task CRUD endpoints
β”‚   β”œβ”€β”€ tests/
β”‚   β”‚   └── test_api.py       # Pytest test suite (20+ tests)
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ frontend/                 # React + Axios
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.js            # Root component & state management
β”‚   β”‚   β”œβ”€β”€ api.js            # Axios instance with auth interceptors
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.js      # Login form
β”‚   β”‚   β”‚   β”œβ”€β”€ Register.js   # Registration form
β”‚   β”‚   β”‚   β”œβ”€β”€ TaskList.js   # Task grid with cards
β”‚   β”‚   β”‚   └── TaskForm.js   # Create / edit task modal
β”‚   β”‚   └── __tests__/
β”‚   β”‚       └── components.test.js  # Jest + RTL test suite
β”‚   β”œβ”€β”€ public/index.html
β”‚   β”œβ”€β”€ nginx.conf
β”‚   β”œβ”€β”€ package.json
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── ci.yml           
β”‚
β”œβ”€β”€ docker-compose.yml
└── README.md

πŸš€ Quick Start (Local Development)

Prerequisites

Tool Version
Python 3.11+
Node.js 20+
npm 9+
Docker 24+ (optional)

1. Clone the repository

git clone https://github.com/your-username/taskflow-project.git
cd taskflow-project

2. Run the Backend

cd backend

# Create a virtual environment
python -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Start the development server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

The API will be available at http://localhost:8000


3. Run the Frontend

Open a new terminal:

cd frontend

# Install dependencies
npm install

# Start the development server
npm start

The React app will open at http://localhost:3000

The frontend is pre-configured to proxy API requests to http://localhost:8000


πŸ§ͺ Running Tests

Backend Tests (Pytest)

cd backend
source venv/bin/activate

# Run all tests with verbose output
pytest tests/ -v

# Run with coverage report
pytest tests/ -v --cov=app --cov-report=term-missing

Test coverage includes:

  • Health check endpoint
  • User registration (success, duplicate username, duplicate email)
  • User login (success, wrong password, nonexistent user)
  • Task creation (success, unauthenticated, invalid assignee)
  • Task retrieval (list, single, not found)
  • Task update (success, unauthorised)
  • Task completion
  • Task deletion (success, unauthorisd)
  • Task assignment to team members

Frontend Tests (Jest + React Testing Library)

cd frontend

# Run all tests once (CI mode)
npm test

# Run in watch mode (development)
npm run test -- --watch

Test coverage includes:

  • Login component renders all fields correctly
  • Register component renders all fields correctly
  • Navigation between Login and Register works
  • TaskList renders tasks from props
  • TaskList shows empty state correctly
  • Task action buttons (complete, edit, delete) fire correct callbacks
  • TaskForm renders in create and edit modes
  • TaskForm calls onSubmit with correct form data

🐳 Running with Docker

Using Docker Compose (recommended)

# Build and start all services
docker-compose up --build

# Run in background
docker-compose up -d --build

# View logs
docker-compose logs -f

# Stop all services
docker-compose down

Services started:

Service URL
Frontend http://localhost:80
Backend http://localhost:8000
API Docs http://localhost:8000/docs

Build images individually

# Backend
docker build -t taskflow-backend ./backend
docker run -p 8000:8000 taskflow-backend

# Frontend
docker build -t taskflow-frontend ./frontend
docker run -p 80:80 taskflow-frontend

βš™οΈ Environment Variables

Backend (backend/.env)

DATABASE_URL=sqlite:///./taskflow.db
ALLOWED_ORIGINS=http://localhost:3000

Frontend (frontend/.env)

REACT_APP_API_URL=http://localhost:8000

πŸ”„ CI Pipeline β€” How It Works

The CI pipeline is defined in .github/workflows/ci.yml and runs automatically on every push or pull request to the main and develop branches.

Pipeline Overview

Push / PR to main or develop
           β”‚
           β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚   Backend    β”‚      β”‚    Frontend        β”‚
    β”‚  (Python)    β”‚      β”‚   (Node.js)        β”‚
    β”‚              β”‚      β”‚                    β”‚
    β”‚ 1. Checkout  β”‚      β”‚ 1. Checkout        β”‚
    β”‚ 2. Python 11 β”‚      β”‚ 2. Node.js 20      β”‚
    β”‚ 3. pip ci    β”‚      β”‚ 3. npm ci          β”‚
    β”‚ 4. pytest    β”‚      β”‚ 4. npm test        β”‚
    β”‚              β”‚      β”‚ 5. npm run build   β”‚
    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚                       β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚  Docker Build β”‚
              β”‚  Validation   β”‚
              β”‚               β”‚
              β”‚ Build backend β”‚
              β”‚ Build frontendβ”‚
              β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚  CI Summary   β”‚
              β”‚  βœ… or ❌     β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Pipeline Jobs

Job What it does
backend Sets up Python, installs deps, runs 20+ pytest tests
frontend Sets up Node.js, installs deps, runs Jest tests, builds production bundle
docker-build Validates that both Dockerfiles build without errors (runs after both tests pass)
ci-summary Prints a summary report of all job outcomes

Key CI Features

  • Dependency caching β€” pip and npm caches are preserved between runs for speed
  • Parallel jobs β€” Backend and frontend run simultaneously, not sequentially
  • Build artifacts β€” Production build is uploaded and available for 7 days
  • Failure artifacts β€” Test database saved on failure for debugging
  • Conditional execution β€” Docker build only runs if tests pass

🌐 API Reference

Auth Endpoints

Method Endpoint Description
POST /users/register Register a new user
POST /users/login Login and receive access token
GET /users/ List all users
GET /users/{id} Get user by ID

Task Endpoints

All task endpoints require Authorization: Bearer <token> header

Method Endpoint Description
GET /tasks/ List all tasks
POST /tasks/ Create a new task
GET /tasks/{id} Get task by ID
PUT /tasks/{id} Update a task
DELETE /tasks/{id} Delete a task
PATCH /tasks/{id}/complete Mark task as completed

Example: Register & Create Task

# 1. Register
curl -X POST http://localhost:8000/users/register \
  -H "Content-Type: application/json" \
  -d '{"username":"alice","email":"alice@example.com","password":"secret123","full_name":"Alice Smith"}'

# 2. Login
curl -X POST http://localhost:8000/users/login \
  -H "Content-Type: application/json" \
  -d '{"username":"alice","password":"secret123"}'

# 3. Create task (use token from login response)
curl -X POST http://localhost:8000/tasks/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer demo-token-1" \
  -d '{"title":"Fix the login bug","priority":"high","status":"todo"}'

πŸ—οΈ Tech Stack

Layer Technology
Backend Framework FastAPI 0.111
Language Python 3.11
Database SQLite
ORM SQLAlchemy 2.0
Password Hashing passlib (bcrypt)
Frontend Framework React 18
HTTP Client Axios
Backend Testing Pytest
Frontend Testing Jest + React Testing Library
Containerisation Docker + Docker Compose
CI/CD GitHub Actions
Web Server Nginx (production frontend)

πŸ“ Notes for CI Demo

  1. Fork this repo to your GitHub account
  2. Push a change to main or open a pull request
  3. Watch the Actions tab β€” all 4 jobs run automatically
  4. Try breaking a test (assert False) to see the pipeline fail in red
  5. Fix it and push again to see it go green

Built to demonstrate CI/CD best practices in a realistic full-stack context.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages