# Todo API A simple Todo API built with FastAPI, SQLAlchemy, and SQLite. ## Features - Full CRUD operations for todos - RESTful API design - Automatic API documentation with Swagger/OpenAPI - SQLite database with SQLAlchemy ORM - Database migrations with Alembic - CORS enabled for all origins - Health check endpoint ## API Endpoints ### Base Endpoints - `GET /` - Root endpoint with API information - `GET /health` - Health check endpoint - `GET /docs` - Swagger UI documentation - `GET /redoc` - ReDoc documentation ### Todo Endpoints All todo endpoints are prefixed with `/api/v1/todos` - `GET /api/v1/todos/` - List all todos (with pagination) - Query parameters: `skip` (default: 0), `limit` (default: 100) - `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 todo by ID - `DELETE /api/v1/todos/{todo_id}` - Delete a todo by ID ## Data Model Each todo has the following fields: - `id` (integer) - Unique identifier - `title` (string, required) - Todo title (1-200 characters) - `description` (string, optional) - Todo description (max 1000 characters) - `completed` (boolean) - Completion status (default: false) - `created_at` (datetime) - Creation timestamp - `updated_at` (datetime) - Last update timestamp ## Quick Start 1. Install dependencies: ```bash pip install -r requirements.txt ``` 2. Start the application: ```bash uvicorn main:app --reload ``` 3. The API will be available at `http://localhost:8000` - API documentation: `http://localhost:8000/docs` - Alternative docs: `http://localhost:8000/redoc` ## Database The application uses SQLite with the database file stored at `/app/storage/db/db.sqlite`. Database tables are automatically created when the application starts. ## Project Structure ``` / ├── main.py # FastAPI application entry point ├── requirements.txt # Python dependencies ├── alembic.ini # Alembic configuration ├── alembic/ # Database migrations ├── app/ │ ├── __init__.py │ ├── api/ # API routes │ │ ├── __init__.py │ │ └── todos.py # Todo CRUD endpoints │ ├── db/ # Database configuration │ │ ├── __init__.py │ │ ├── base.py # SQLAlchemy Base │ │ └── session.py # Database session management │ ├── models/ # SQLAlchemy models │ │ ├── __init__.py │ │ └── todo.py # Todo model │ └── schemas/ # Pydantic schemas │ ├── __init__.py │ └── todo.py # Todo request/response schemas ```