
- Created FastAPI application with CRUD operations for todos - Implemented SQLite database with SQLAlchemy ORM - Added Alembic for database migrations - Set up CORS middleware for all origins - Added health check endpoint at /health - Created comprehensive API documentation - Formatted code with Ruff linter - Updated README with project information Features: - Create, read, update, delete todos - Pagination support for listing todos - Auto-generated OpenAPI documentation at /docs - Health monitoring endpoint
Todo App API
A simple Todo application API built with FastAPI and SQLite.
Features
- Create, read, update, and delete todos
- SQLite database with SQLAlchemy ORM
- Database migrations with Alembic
- CORS enabled for all origins
- Health check endpoint
- Auto-generated API documentation
Installation
- Install dependencies:
pip install -r requirements.txt
- Run the application:
uvicorn main:app --reload
The API will be available at http://localhost:8000
API Endpoints
GET /
- Root endpoint with API informationGET /health
- Health check endpointGET /docs
- Interactive API documentation (Swagger UI)GET /redoc
- Alternative API documentationPOST /todos
- Create a new todoGET /todos
- Get all todos (with pagination)GET /todos/{todo_id}
- Get a specific todoPUT /todos/{todo_id}
- Update a todoDELETE /todos/{todo_id}
- Delete a todo
Database
The application uses SQLite database stored at /app/storage/db/db.sqlite
. Database migrations are managed with Alembic.
Project Structure
├── main.py # FastAPI application entry point
├── requirements.txt # Python dependencies
├── alembic.ini # Alembic configuration
├── alembic/ # Database migrations
│ ├── env.py
│ ├── script.py.mako
│ └── versions/
│ └── 001_create_todos_table.py
└── app/
├── __init__.py
├── schemas.py # Pydantic schemas
├── db/
│ ├── __init__.py
│ ├── base.py # SQLAlchemy base
│ └── session.py # Database session
├── models/
│ ├── __init__.py
│ └── todo.py # Todo model
└── routers/
├── __init__.py
└── todos.py # Todo API endpoints
Description
Languages
Python
92.9%
Mako
7.1%