A clean, production-style basic FastAPI project.
Includes JWT authentication, CRUD APIs, SQLAlchemy ORM, pytest tests, Docker, and GitHub Actions CI.
- JWT authentication (signup/login)
- CRUD for tasks (per-user access)
- SQLite + SQLAlchemy ORM
- Dockerfile for containerization
- GitHub Actions CI (tests run on every push)
- Clear project structure & unit tests
- Signup
POST /auth/signup { "email": "test@example.com", "password": "secret1" }
- Login
→ copy
POST /auth/login username=test@example.com password=secret1access_token - Authorize in Swagger (top-right) with
Bearer <token> - Create a Task
POST /tasks { "title": "My first task", "description": "demo", "is_done": false }
- List Tasks
GET /tasks [ { "id": 1, "title": "My first task", "description": "demo", "is_done": false, "owner_id": 1 } ]
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install --upgrade pippip install -r requirements.txtuvicorn app.main:app --reloadOpen: http://127.0.0.1:8000/docs
pytest -qdocker build -t task-tracker-api:dev .
docker run -p 8000:8000 task-tracker-api:devCopy .env.example → .env and optionally edit the secret key. Defaults are safe for local dev.
POST /auth/signup– Create userPOST /auth/login– Get JWT tokenGET /tasks– List tasks (per-user only)POST /tasks– Create taskPUT /tasks/{task_id}– Update taskDELETE /tasks/{task_id}– Delete task
Use the Authorize button in /docs (bearer token) after login.
task-tracker-api/
├─ app/
│ ├─ main.py
│ ├─ db.py
│ ├─ models.py
│ ├─ schemas.py
│ ├─ crud.py
│ ├─ auth.py
│ ├─ dependencies.py
│ └─ routers/
│ ├─ users.py
│ └─ tasks.py
├─ tests/
│ ├─ test_auth.py
│ └─ test_tasks.py
├─ docs/
│ └─ swagger.png
├─ .github/workflows/ci.yml
├─ requirements.txt
├─ Dockerfile
├─ .gitignore
├─ .env.example
└─ LICENSE
MIT © 2025
