A REST API where users can manage their daily tasks — built with FastAPI, PostgreSQL, and SQLAlchemy.
This is a more realistic follow-up to the Student API project, adding priority levels, due dates, and completion status.
- Python 3.10+
- FastAPI — web framework
- PostgreSQL — database
- SQLAlchemy — ORM
- Pydantic — data validation
- Swagger UI — interactive API docs (built into FastAPI)
- Postman — for manual API testing
Task-Manager-API/
│
├── app/
│ ├── __init__.py
│ ├── main.py # FastAPI app & route definitions
│ ├── database.py # SQLAlchemy engine/session setup
│ ├── models.py # ORM models (Task table)
│ ├── schemas.py # Pydantic request/response schemas
│ ├── crud.py # DB access logic (Create/Read/Update/Delete)
│ └── config.py # App settings & environment variables
│
├── .gitignore
├── requirements.txt
└── README.md
| Field | Type | Notes |
|---|---|---|
id |
UUID | Primary key, auto-generated |
title |
string | Required |
description |
string | Optional |
completed |
boolean | Defaults to false |
priority |
enum: Low, Medium, High |
Defaults to Medium |
due_date |
date (YYYY-MM-DD) |
Optional |
created_at |
datetime | Auto-set on creation |
Example request body:
{
"title": "Complete FastAPI Course",
"description": "Finish FastAPI CRUD section",
"completed": false,
"priority": "High",
"due_date": "2026-08-10"
}| Method | Endpoint | Description |
|---|---|---|
| POST | /tasks |
Create a new task |
| GET | /tasks |
Get all tasks (supports filters + pagination) |
| GET | /tasks/{id} |
Get a single task by ID |
| PUT | /tasks/{id} |
Update an existing task (partial updates OK) |
| DELETE | /tasks/{id} |
Delete a task |
Query parameters for GET /tasks:
skip(int, default0) — pagination offsetlimit(int, default100, max500) — page sizecompleted(bool) — filter by completion statuspriority(Low/Medium/High) — filter by priority
git clone <your-repo-url>
cd Task-Manager-API
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activatepip install -r requirements.txtCreate a PostgreSQL database (e.g. task_manager_db), then create a .env file in the project root:
DB_USER=postgres
DB_PASSWORD=your_password
DB_HOST=localhost
DB_PORT=5432
DB_NAME=task_manager_dbOr set DATABASE_URL directly to override everything:
DATABASE_URL=postgresql://postgres:your_password@localhost:5432/task_manager_dbuvicorn app.main:app --reloadTables are created automatically on startup (via Base.metadata.create_all).
- Swagger UI: http://127.0.0.1:8000/docs
- ReDoc: http://127.0.0.1:8000/redoc
- Or import the endpoints into Postman and test manually.
- ✅ Priority field (
Low/Medium/High) - ✅ Due Date tracking
- ✅ Completed status flag
- ✅ Filtering & pagination on
GET /tasks
- User authentication (JWT) so tasks belong to specific users
- Sorting by
due_date/priority - Alembic migrations instead of
create_all - Unit tests with
pytest+ a test database - Dockerfile +
docker-compose.ymlfor one-command setup