A REST API for managing tasks, built with FastAPI and PostgreSQL. Handles auth with JWT, full CRUD on tasks, and runs cleanly in Docker. Nothing fancy, just solid.
cp .env.example .env
docker compose up --buildAPI is at http://localhost:8000. Docs at http://localhost:8000/docs.
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/v1/auth/register |
No | Create account |
| POST | /api/v1/auth/login |
No | Get JWT token |
| GET | /api/v1/tasks |
Yes | List your tasks (paginated) |
| POST | /api/v1/tasks |
Yes | Create a task |
| GET | /api/v1/tasks/{id} |
Yes | Get single task |
| PUT | /api/v1/tasks/{id} |
Yes | Update task |
| DELETE | /api/v1/tasks/{id} |
Yes | Delete task |
| GET | /health |
No | Health check |
Query params on GET /tasks: skip, limit, status (todo/in_progress/done).
python -m venv venv
source venv/bin/activate # windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# edit .env with your local postgres connectionRun migrations (once you have postgres running):
alembic upgrade headStart the server:
uvicorn app.main:app --reloadThe lifespan handler auto-creates tables if they don't exist — handy for quick local hacks, but use alembic for anything real.
Tests use SQLite in memory so you don't need postgres running.
pytest -v- Tokens expire after 30 minutes (configurable via
ACCESS_TOKEN_EXPIRE_MINUTES) - Users can only see and modify their own tasks
SECRET_KEYin.env.exampleis a placeholder — generate a proper one for prod:openssl rand -hex 32# might need to tweak this for prod