Simple Todo Application
A simple todo application API built with FastAPI and SQLite.
Features
- Create, read, update, and delete todo items
- Health check endpoint
- API documentation
- Database migrations with Alembic
Project Structure
/
├── alembic/ # Database migration scripts
├── app/ # Application code
│ ├── api/ # API endpoints
│ │ ├── endpoints/ # API endpoint implementations
│ │ │ ├── health.py # Health check endpoint
│ │ │ └── todos.py # Todo endpoints
│ │ └── routes.py # API router configuration
│ ├── core/ # Core application code
│ │ └── config.py # Application configuration
│ ├── db/ # Database configuration
│ │ └── database.py # Database connection setup
│ ├── models/ # SQLAlchemy models
│ │ └── todo.py # Todo model
│ └── schemas/ # Pydantic schemas
│ └── todo.py # Todo schemas
├── alembic.ini # Alembic configuration
├── main.py # Application entry point
└── requirements.txt # Project dependencies
Getting Started
Prerequisites
- Python 3.8 or higher
Installation
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
Database Setup
- Run database migrations:
alembic upgrade head
Running the Application
Start the application with:
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 at:
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc
API Endpoints
GET /api/v1/health
- Health check endpointGET /api/v1/todos
- List all todosPOST /api/v1/todos
- Create a new todoGET /api/v1/todos/{todo_id}
- Get a specific todoPUT /api/v1/todos/{todo_id}
- Update a todoDELETE /api/v1/todos/{todo_id}
- Delete a todo
Description
Languages
Python
95.6%
Mako
4.4%