Simple Todo Application
A simple todo application API built with FastAPI and SQLite.
Features
- Create, read, update, and delete todo items
- Built with FastAPI for high performance
- SQLite database with SQLAlchemy ORM
- Alembic for database migrations
- Health check endpoint
Requirements
- Python 3.8+
- FastAPI
- SQLAlchemy
- Uvicorn
- Alembic
- Ruff
Installation
- Clone the repository:
git clone <repository-url>
cd simpletodoapplication-ti5xsx
- Install dependencies:
pip install -r requirements.txt
Usage
- Run the API server:
python main.py
Or with uvicorn directly:
uvicorn main:app --reload
- Access the API documentation:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
API Endpoints
Health Check
GET /health
- Check if the API is running
Todo Endpoints
GET /api/v1/todos/
- Get all todosPOST /api/v1/todos/
- Create a new todoGET /api/v1/todos/{todo_id}
- Get a specific todoPUT /api/v1/todos/{todo_id}
- Update a todoDELETE /api/v1/todos/{todo_id}
- Delete a todo
Database Migrations
This project uses Alembic for database migrations:
# Apply migrations
alembic upgrade head
# Create a new migration after model changes
alembic revision --autogenerate -m "Description of changes"
Project Structure
simpletodoapplication-ti5xsx/
├── alembic.ini
├── app/
│ ├── __init__.py
│ ├── api/
│ │ ├── __init__.py
│ │ └── routes.py
│ ├── db/
│ │ ├── __init__.py
│ │ ├── database.py
│ │ └── models.py
│ └── schemas/
│ ├── __init__.py
│ └── todo.py
├── main.py
├── migrations/
│ ├── env.py
│ ├── script.py.mako
│ └── versions/
│ └── 47fb0c1c35a0_initial_migration.py
└── requirements.txt
Description
Languages
Python
94.3%
Mako
5.7%