# FastAPI Todo App A simple Todo REST API built with FastAPI and SQLite. ## Features - Create, read, update, and delete Todo items - SQLite database with SQLAlchemy ORM - Database migrations with Alembic - API documentation with Swagger UI - Health check endpoint ## Project Structure ``` ├── app │ ├── api # API routes │ │ └── routes │ │ ├── health.py # Health check endpoint │ │ └── todos.py # Todo CRUD operations │ ├── core # Core application code │ │ └── config.py # Application settings │ ├── db # Database related code │ │ └── session.py # Database session setup │ ├── models # SQLAlchemy models │ │ └── todo.py # Todo model │ └── schemas # Pydantic schemas/models │ └── todo.py # Todo schemas for request/response ├── migrations # Alembic migrations │ ├── versions │ │ └── e9bac9a7a1e3_create_todos_table.py # Initial migration │ ├── env.py │ └── script.py.mako ├── alembic.ini # Alembic configuration ├── main.py # Application entry point └── requirements.txt # Python dependencies ``` ## Installation 1. Clone the repository 2. Install the dependencies: ```bash pip install -r requirements.txt ``` ## Running the Application Start the FastAPI application: ```bash uvicorn main:app --reload ``` The API will be available at http://localhost:8000. ## API Documentation Once the application is running, you can access the API documentation: - Swagger UI: http://localhost:8000/docs - ReDoc: http://localhost:8000/redoc ## API Endpoints ### Health Check - `GET /health` - Check API health ### Todo Operations - `GET /api/todos` - List all todos - `POST /api/todos` - Create a new todo - `GET /api/todos/{todo_id}` - Get a specific todo - `PUT /api/todos/{todo_id}` - Update a todo - `DELETE /api/todos/{todo_id}` - Delete a todo ## Example Payloads ### Create Todo ```json { "title": "Buy groceries", "description": "Milk, bread, eggs", "completed": false } ``` ### Update Todo ```json { "title": "Buy groceries", "description": "Milk, bread, eggs, cheese", "completed": true } ``` ## Database The application uses SQLite as its database, which is stored at `/app/storage/db/db.sqlite`. Migrations are managed with Alembic.