Task Manager API
A RESTful API for managing tasks built with FastAPI and SQLite.
Features
- Create, read, update, and delete tasks
- Filter tasks by completion status and priority
- Health check endpoint
- SQLite database with SQLAlchemy ORM
- Database migrations with Alembic
Tech Stack
- Framework: FastAPI
- Database: SQLite
- ORM: SQLAlchemy
- Migrations: Alembic
Project Structure
.
├── app
│ ├── api
│ │ ├── endpoints
│ │ │ ├── health.py
│ │ │ └── tasks.py
│ │ └── api.py
│ ├── core
│ ├── db
│ │ └── database.py
│ ├── models
│ │ └── task.py
│ ├── schemas
│ │ └── task.py
│ └── main.py
├── migrations
│ ├── versions
│ │ └── 001_create_tasks_table.py
│ ├── env.py
│ └── script.py.mako
├── storage
│ └── db
├── alembic.ini
├── main.py
├── README.md
└── requirements.txt
Installation
- Clone the repository:
git clone https://github.com/yourusername/taskmanagerapi.git
cd taskmanagerapi
- Install dependencies:
pip install -r requirements.txt
- Run database migrations:
alembic upgrade head
Usage
Running the API
# Development with auto-reload
python main.py
# Or using uvicorn directly
uvicorn app.main:app --reload
The API will be available at http://localhost:8000
.
API Documentation
FastAPI automatically generates interactive API documentation:
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc
API Endpoints
Health Check
GET /health
- Check API and database health
Tasks
GET /tasks
- List all tasks (with optional filtering)POST /tasks
- Create a new taskGET /tasks/{task_id}
- Get a specific taskPUT /tasks/{task_id}
- Update a taskDELETE /tasks/{task_id}
- Delete a task
Task Model
{
"id": 1,
"title": "Example Task",
"description": "This is an example task",
"completed": false,
"priority": 1,
"due_date": "2023-09-30T00:00:00Z",
"created_at": "2023-09-25T15:00:00Z",
"updated_at": "2023-09-25T15:00:00Z"
}
Priority Levels
0
: Low1
: Medium2
: High
License
This project is licensed under the MIT License.
Description
Languages
Python
95.3%
Mako
4.7%