Task Management API
A simple task management API built with FastAPI and SQLite.
Features
- Create, read, update, and delete tasks
- Mark tasks as completed
- Filter tasks by completion status and priority
- Set due dates for tasks
- Health check endpoint
Tech Stack
- Python 3.9+
- FastAPI for API development
- SQLAlchemy for ORM
- Alembic for database migrations
- SQLite for database storage
- Pydantic for data validation
- Uvicorn for ASGI server
Project Structure
.
├── app/ # Application package
│ ├── api/ # API endpoints
│ │ └── routes/ # API route definitions
│ ├── core/ # Core configuration
│ ├── db/ # Database configurations
│ ├── models/ # SQLAlchemy models
│ └── schemas/ # Pydantic schemas
├── migrations/ # Alembic migration scripts
├── alembic.ini # Alembic configuration
├── main.py # Entry point for the application
└── requirements.txt # Dependencies
Getting Started
Prerequisites
- Python 3.9+
- SQLite
Installation
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
- Run the application:
uvicorn main:app --reload
API Documentation
Once the application is running, you can access the API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
API Endpoints
Health Check
GET /health
- Check if the API is running
Task Management
GET /api/tasks
- List all tasksPOST /api/tasks
- Create a new taskGET /api/tasks/{task_id}
- Get a specific taskPUT /api/tasks/{task_id}
- Update a taskDELETE /api/tasks/{task_id}
- Delete a taskPOST /api/tasks/{task_id}/complete
- Mark a task as completed
Task Model
id
: Unique identifiertitle
: Title of the taskdescription
: Optional descriptionis_completed
: Task completion statuspriority
: Task priority (1=Low, 2=Medium, 3=High)created_at
: Creation timestampupdated_at
: Last update timestampcompleted_at
: Completion timestamp (if completed)due_date
: Optional due date
Description
Languages
Python
96.3%
Mako
3.7%