A small REST API for managing tasks, built to practise FastAPI, Pydantic validation and clean object-oriented structure.
- CRUD endpoints:
POST /tasks,GET /tasks,GET /tasks/{id},PATCH /tasks/{id},DELETE /tasks/{id} - Validation with Pydantic v2 (empty titles are rejected with HTTP 422)
- Filtering by
doneandpriority; open, high-priority tasks are listed first - Storage behind an abstract
TaskRepositoryinterface, injected with FastAPIDepends, so the in-memory store can be replaced by a database without touching the endpoints - Thread-safe in-memory implementation
- Tests with
pytestand FastAPI'sTestClient
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reloadOpen http://127.0.0.1:8000/docs for the interactive Swagger UI.
pytest -qapp/models.py Pydantic schemas (TaskCreate, TaskUpdate, Task)
app/repository.py TaskRepository interface + in-memory implementation
app/main.py FastAPI app and routes
tests/ API tests
- SQLite storage with SQLModel
- Authentication (OAuth2 password flow with JWT)
- Docker image