# Todo Application API A Todo application backend built with Python, FastAPI, and SQLAlchemy. ## Features - Create, read, update, and delete todo items - List all todos with pagination - Persistent storage using SQLite - API documentation with Swagger UI and ReDoc ## Tech Stack - **FastAPI**: High-performance web framework for building APIs - **SQLAlchemy**: SQL toolkit and ORM - **Alembic**: Database migration tool - **Pydantic**: Data validation and settings management - **SQLite**: Lightweight disk-based database (stored in `/storage/db/db.sqlite`) - **Uvicorn**: ASGI server ## Project Structure ``` . ├── alembic/ # Database migrations │ └── versions/ # Migration scripts ├── app/ # Application code │ ├── api/ # API endpoints │ │ └── endpoints/ # API route handlers │ ├── core/ # Core functionality │ ├── db/ # Database │ │ └── repositories/ # Database repositories │ ├── models/ # SQLAlchemy models │ └── schemas/ # Pydantic schemas ├── alembic.ini # Alembic config ├── main.py # Application entry point └── requirements.txt # Dependencies ``` ## Getting Started ### Prerequisites - Python 3.8+ ### Installation 1. Clone the repository 2. Install the dependencies: ``` pip install -r requirements.txt ``` 3. Run database migrations: ``` alembic upgrade head ``` This will create the SQLite database file at `/storage/db/db.sqlite` 4. Start the server: ``` uvicorn main:app --reload ``` ### Database Configuration The application uses SQLite as its database backend. The database file is stored at `/storage/db/db.sqlite`, outside the project root directory for better data isolation. The directory is automatically created if it doesn't exist. To change the database location, modify the `DB_DIR` variable in `app/core/config.py`. ### API Documentation Once the server is running, you can access: - Swagger UI: http://localhost:8000/docs - ReDoc: http://localhost:8000/redoc ## API Endpoints - `GET /api/v1/todos`: List all todos - `POST /api/v1/todos`: Create a new todo - `GET /api/v1/todos/{todo_id}`: Get a specific todo - `PUT /api/v1/todos/{todo_id}`: Update a specific todo - `DELETE /api/v1/todos/{todo_id}`: Delete a specific todo