
- Created comprehensive task management system with CRUD operations - Implemented SQLAlchemy models and database configuration - Added Alembic migrations for database schema management - Created FastAPI endpoints for task management with proper validation - Added health check endpoint and base URL information - Configured CORS middleware and OpenAPI documentation - Updated README with comprehensive API documentation - Code formatted and linted with Ruff
Task Manager API
A simple and efficient task management API built with FastAPI and SQLite.
Features
- Create, read, update, and delete tasks
- Filter tasks by completion status
- Filter tasks by priority level
- Automatic timestamps for task creation and updates
- SQLite database with SQLAlchemy ORM
- Database migrations with Alembic
- Interactive API documentation with Swagger UI
- Health check endpoint
- CORS support for cross-origin requests
Installation
-
Clone the repository
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
uvicorn main:app --reload
API Endpoints
Base Information
GET /
- API information and available endpointsGET /health
- Health check endpoint
Task Management
POST /api/v1/tasks
- Create a new taskGET /api/v1/tasks
- List all tasks (with optional filtering)GET /api/v1/tasks/{task_id}
- Get a specific taskPUT /api/v1/tasks/{task_id}
- Update a taskDELETE /api/v1/tasks/{task_id}
- Delete a taskGET /api/v1/tasks/priority/{priority}
- Get tasks by priority
Query Parameters
skip
- Number of tasks to skip (pagination)limit
- Maximum number of tasks to returncompleted
- Filter by completion status (true/false)
Task Schema
{
"id": 1,
"title": "Example Task",
"description": "Task description",
"completed": false,
"priority": "medium",
"created_at": "2024-01-01T00:00:00",
"updated_at": "2024-01-01T00:00:00",
"due_date": "2024-01-02T00:00:00"
}
Priority Levels
low
medium
high
Database
The application uses SQLite as the database, stored in /app/storage/db/db.sqlite
. The database schema is managed using Alembic migrations.
API Documentation
Once the application is running, you can access:
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc
- OpenAPI JSON:
http://localhost:8000/openapi.json
Development
Running with uvicorn
uvicorn main:app --reload --host 0.0.0.0 --port 8000
Database Migrations
The application automatically creates the database tables on startup. Migration files are located in the alembic/versions/
directory.
Health Check
The API provides a health check endpoint at /health
that returns the current status of the service.
CORS Configuration
The API is configured to allow all origins for development purposes. In production, you should restrict this to specific domains.
Description
Languages
Python
94.7%
Mako
5.3%