This is a small FastAPI backend for a task tracker app.
It exposes a simple JSON API for creating, reading, updating, and deleting tasks, then persists that data to a local JSON file.
Current structure is split into:
app/api: FastAPI route definitionsapp/db: repository and storage layersapp/models: Pydantic request/response modelsapp/core: app configuration and logging
- Python 3.12+
- FastAPI
- Uvicorn
- Pytest
- Python 3.12+
- Poetry
poetry installpoetry run uvicorn app.main:create_app --factory --reloadOR
fastapi devThen open:
- API:
http://127.0.0.1:8000 - Swagger UI:
http://127.0.0.1:8000/docs - ReDoc:
http://127.0.0.1:8000/redoc
By default, task data is stored at data/tasks.json.
You can override this with an environment variable:
DATA_FILE_PATH=/absolute/path/tasks.jsonRoutes:
GET /api/v1/tasks/healthGET /api/v1/tasks/GET /api/v1/tasks/{task_id}POST /api/v1/tasks/PATCH /api/v1/tasks/{task_id}DELETE /api/v1/tasks/DELETE /api/v1/tasks/{task_id}
Each task looks like this:
{
"id": 1,
"title": "Write README",
"description": "Trim the docs down",
"priority": "UNSET",
"completed": false,
"due_date": null,
"completed_at": null,
"created_at": "2026-03-31T12:00:00Z",
"updated_at": "2026-03-31T12:00:00Z"
}Notes:
descriptionis optionalprioritydefaults toUNSETcompleteddefaults tofalse- missing tasks return
404 - storage failures return
500
Create a task:
curl -X POST http://127.0.0.1:8000/api/v1/tasks/ \
-H "Content-Type: application/json" \
-d '{"title":"Write README","description":"Trim the docs down"}'List tasks:
curl http://127.0.0.1:8000/api/v1/tasks/Update a task:
curl -X PATCH http://127.0.0.1:8000/api/v1/tasks/1 \
-H "Content-Type: application/json" \
-d '{"title":"Write a shorter README"}'Delete a task:
curl -X DELETE http://127.0.0.1:8000/api/v1/tasks/1Delete all tasks:
curl -X DELETE http://127.0.0.1:8000/api/v1/tasks/poetry run pytest -qThe test suite covers the main CRUD flows, error handling, and JSON persistence behavior.