
- Created REST API for managing todo items - Implemented SQLite database with SQLAlchemy ORM - Added Alembic for database migrations - Added health check endpoint generated with BackendIM... (backend.im)
Simple Todo Application
A simple Todo API application built with FastAPI and SQLite.
Features
- RESTful API for managing todo items
- SQLite database with SQLAlchemy ORM
- Alembic migrations for database versioning
- Health check endpoint
- Swagger UI documentation
Project Structure
.
├── alembic.ini
├── app
│ ├── api
│ │ └── routes
│ │ ├── health.py
│ │ └── todos.py
│ ├── db
│ │ ├── database.py
│ │ └── init_db.py
│ ├── models
│ │ └── todo.py
│ └── schemas
│ └── todo.py
├── main.py
├── migrations
│ ├── README
│ ├── env.py
│ ├── script.py.mako
│ └── versions
│ └── initial_migration.py
└── requirements.txt
Installation
- Clone the repository
- Install the dependencies:
pip install -r requirements.txt
Running the Application
uvicorn main:app --reload
The application will be available at http://localhost:8000.
API Documentation is available at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
API Endpoints
Health Check
GET /health
- Check API health
Todo Operations
GET /todos
- List all todosPOST /todos
- Create a new todoGET /todos/{todo_id}
- Get a specific todoPUT /todos/{todo_id}
- Update a todoDELETE /todos/{todo_id}
- Delete a todo
Database
The application uses SQLite with SQLAlchemy ORM. The database file is stored at /app/storage/db/db.sqlite
.
Migrations
This project uses Alembic for database migrations. To run migrations:
alembic upgrade head
Description
Languages
Python
94.9%
Mako
5.1%