
- Set up project structure with FastAPI - Configure SQLite database with SQLAlchemy - Create Task model with Alembic migrations - Implement CRUD API endpoints for tasks - Add health check and CORS configuration - Update documentation
Task Manager API
This is a FastAPI-based Task Manager API with SQLite backend. It provides endpoints for managing tasks with features like priority, due dates, and filtering.
Features
- Create, read, update, and delete tasks
- Mark tasks as completed
- Filter tasks by completion status and priority
- SQLite database with SQLAlchemy ORM
- Alembic for database migrations
- FastAPI automatic API documentation
API Endpoints
GET /health
: Health check endpointGET /api/v1/tasks
: List all tasks (with optional filtering)POST /api/v1/tasks
: Create a new taskGET /api/v1/tasks/{task_id}
: Get a specific taskPUT /api/v1/tasks/{task_id}
: Update a taskDELETE /api/v1/tasks/{task_id}
: Delete a taskPATCH /api/v1/tasks/{task_id}/complete
: Mark a task as completed
Project Structure
taskmanagerapi/
├── alembic.ini # Alembic configuration
├── main.py # FastAPI application entry point
├── requirements.txt # Python dependencies
├── app/ # Application code
│ ├── api/ # API routes
│ │ └── v1/ # API version 1
│ │ ├── endpoints/ # API endpoint handlers
│ │ └── router.py # API router
│ ├── core/ # Core application code
│ │ └── config.py # Application configuration
│ ├── db/ # Database related code
│ │ └── session.py # Database session setup
│ ├── models/ # SQLAlchemy models
│ │ └── task.py # Task model
│ └── schemas/ # Pydantic schemas
│ └── task.py # Task schemas
└── migrations/ # Database migrations
├── env.py # Alembic environment
├── script.py.mako # Migration script template
└── versions/ # Migration versions
└── 01_initial_migration.py # Initial migration
Getting Started
Prerequisites
- Python 3.8+
- pip (Python package installer)
Installation
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
- Apply migrations:
alembic upgrade head
- Start the server:
uvicorn main:app --reload
API Documentation
Once the server is running, you can access:
- Swagger UI documentation: http://localhost:8000/docs
- ReDoc documentation: http://localhost:8000/redoc
- OpenAPI JSON: http://localhost:8000/openapi.json
Description
Languages
Python
95.4%
Mako
4.6%