A simple, clean RESTful backend API for managing tasks. Built for learning modern backend development with FastAPI, SQLAlchemy, and automated tests.
- Create, read, update, delete tasks (CRUD)
- Persistent storage with SQLite
- Strong input validation with Pydantic
- Task status enforced via Enum (
open,done) - Automatic API documentation (Swagger)
- Fully tested with pytest (isolated in-memory DB)
- Python 3.10+
- FastAPI
- Uvicorn
- SQLAlchemy (ORM)
- SQLite
- Pydantic v2
- pytest + httpx
app/
├─ api/ # API routes
├─ db/ # database, sessions, dependencies
├─ models/ # SQLAlchemy models
├─ schemas/ # Pydantic schemas
└─ main.py # FastAPI application entry point
tests/
├─ conftest.py # test DB + dependency overrides
└─ test_tasks.py
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txt(or install manually if no requirements.txt yet)
uvicorn app.main:app --reloadOpen in browser:
- API Docs: http://127.0.0.1:8000/docs
- OpenAPI Spec: http://127.0.0.1:8000/openapi.json
POST /tasks{
"title": "Learn FastAPI"
}PUT /tasks/1{
"status": "done"
}pytest -q✔ Uses an in-memory SQLite database ✔ Tests do not affect the production database
This project demonstrates:
- REST API design
- ORM-based persistence
- Dependency Injection
- Automated testing
- Clean backend architecture
- Pagination & filtering
- Authentication (JWT)
- Alembic migrations
- Docker setup
- User management
MIT