# FastAPI Todo API A robust Todo API built with FastAPI and SQLite for efficient task management. ## Features - Create, read, update, and delete todos - SQLite database with SQLAlchemy ORM - Alembic for database migrations - Health check endpoint - Input validation with Pydantic - Automatic API documentation - Fast and efficient database operations ## Project Structure ``` . ├── alembic/ # Database migration files │ └── versions/ # Migration version scripts ├── app/ # Application code │ ├── api/ # API endpoints │ │ └── endpoints/ # Route handlers │ ├── core/ # Core functionality and config │ ├── crud/ # CRUD operations │ ├── db/ # Database setup │ ├── models/ # SQLAlchemy models │ ├── schemas/ # Pydantic schemas │ └── storage/ # Database storage ├── alembic.ini # Alembic configuration ├── main.py # Application entry point └── requirements.txt # Project dependencies ``` ## Getting Started 1. Clone the repository 2. Install the dependencies: ``` pip install -r requirements.txt ``` 3. Run the migrations: ``` alembic upgrade head ``` 4. Start the server: ``` uvicorn main:app --reload ``` ## API Documentation Once the server is running, you can access the interactive API documentation at: - Swagger UI: http://localhost:8000/docs - ReDoc: http://localhost:8000/redoc ## API Endpoints ### Todo Operations - `GET /api/v1/todos/`: Get all todos - `POST /api/v1/todos/`: Create a new todo - `GET /api/v1/todos/{todo_id}`: Get a specific todo by ID - `PUT /api/v1/todos/{todo_id}`: Update a specific todo - `DELETE /api/v1/todos/{todo_id}`: Delete a specific todo ### System Endpoints - `GET /health`: Health check endpoint to verify API status ## Todo Schema ```json { "id": 1, "title": "Complete project", "description": "Finish the FastAPI project by Friday", "completed": false } ``` ## Development The API uses SQLAlchemy for ORM operations and Alembic for database migrations. The database file is stored in `app/storage/db/db.sqlite`. ## Technologies - **FastAPI**: Modern, fast web framework for building APIs - **SQLAlchemy**: SQL toolkit and ORM - **Pydantic**: Data validation and settings management - **Alembic**: Database migration tool - **SQLite**: Lightweight disk-based database