A RESTful API built with FastAPI, MySQL, and SQLAlchemy for managing tasks with full CRUD operations.
- Python, FastAPI, SQLAlchemy, MySQL, Pydantic, Postman
- Create, Read, Update, Delete tasks
- Filter tasks by status (pending / in_progress / completed)
- Auto-generated interactive API docs via Swagger UI
- MVC architecture with clean separation of concerns
task_manager_api/
├── main.py # FastAPI app entry point
├── requirements.txt
├── .env.example
├── database/
│ └── db.py # DB connection & session
├── models/
│ └── task.py # SQLAlchemy Task model
├── schemas/
│ └── task_schema.py # Pydantic request/response schemas
└── routers/
└── tasks.py # All CRUD route handlers
git clone https://github.com/Aptha903/task-manager-api
cd task_manager_api
pip install -r requirements.txtCREATE DATABASE task_manager_db;cp .env.example .env
# Edit .env with your MySQL credentialsuvicorn main:app --reloadVisit: http://127.0.0.1:8000/docs
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Health check |
| POST | /tasks/ |
Create a new task |
| GET | /tasks/ |
Get all tasks (optional: ?status_filter=pending) |
| GET | /tasks/{id} |
Get task by ID |
| PUT | /tasks/{id} |
Update a task |
| DELETE | /tasks/{id} |
Delete a task |
{
"title": "Complete project report",
"description": "Write and submit final ML project report",
"status": "pending",
"due_date": "2026-06-20"
}{
"id": 1,
"title": "Complete project report",
"description": "Write and submit final ML project report",
"status": "pending",
"due_date": "2026-06-20",
"created_at": "2026-06-16T10:00:00",
"updated_at": null
}