
- Set up project structure with FastAPI - Create Todo database model and schema - Implement database connection with SQLAlchemy - Set up Alembic migrations - Implement CRUD API endpoints for Todo items - Add health check endpoint - Update documentation in README.md generated with BackendIM... (backend.im)
Todo Application API
This is a Todo Application API built with FastAPI and SQLite database. It provides CRUD operations for managing todo items.
Features
- Create, read, update, and delete todo items
- Filter todos by completion status
- Health check endpoint
- SQLite database with SQLAlchemy ORM
- Alembic migrations
Project Structure
/
├── app/
│ ├── api/
│ │ ├── health.py # Health check endpoint
│ │ └── todos.py # Todo CRUD endpoints
│ ├── db/
│ │ └── database.py # Database connection
│ ├── models/
│ │ └── todo.py # SQLAlchemy models
│ ├── schemas/
│ │ └── todo.py # Pydantic schemas
│ └── utils/
├── migrations/ # Alembic migrations
│ ├── versions/
│ │ └── 001_create_todos_table.py
│ ├── env.py
│ └── script.py.mako
├── storage/ # SQLite database location
│ └── db/
├── alembic.ini # Alembic configuration
├── main.py # Application entry point
├── requirements.txt # Project dependencies
└── README.md
Getting Started
Prerequisites
- Python 3.7+
- pip
Installation
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
- Run database migrations:
alembic upgrade head
- Start the server:
uvicorn main:app --reload
API Documentation
Once the server is running, you can access the API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
API Endpoints
Todo Endpoints
GET /todos
: Get all todo items (with optional filtering)POST /todos
: Create a new todo itemGET /todos/{todo_id}
: Get a specific todo itemPUT /todos/{todo_id}
: Update a todo itemDELETE /todos/{todo_id}
: Delete a todo item
Health Endpoint
GET /health
: Health check endpoint
Description
Languages
Python
95.6%
Mako
4.4%