Simple Todo Application
A simple RESTful Todo application API built with FastAPI and SQLite.
Features
- Create, read, update, and delete todo items
- SQLite database with SQLAlchemy ORM
- Alembic for database migrations
- Health check endpoint
- API documentation with Swagger UI
Installation
- Clone the repository:
git clone [repository-url]
cd simpletodoapplication
- Install dependencies:
pip install -r requirements.txt
- Apply database migrations:
alembic upgrade head
Running the Application
Start the application with Uvicorn:
uvicorn main:app --reload
The API 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
Todos
GET /api/todos/
- List all todosPOST /api/todos/
- Create a new todoGET /api/todos/{todo_id}
- Get a specific todoPUT /api/todos/{todo_id}
- Update a todoDELETE /api/todos/{todo_id}
- Delete a todo
Health Check
GET /health
- Health check endpoint
Project Structure
.
├── alembic/ # Database migration scripts
├── app/
│ ├── api/ # API routes
│ │ ├── health.py # Health check endpoint
│ │ └── todos.py # Todo API endpoints
│ ├── database/ # Database related code
│ │ ├── base.py # Database connection setup
│ │ └── crud.py # CRUD operations
│ ├── models/ # Data models
│ │ ├── schemas.py # Pydantic schemas
│ │ └── todo.py # SQLAlchemy Todo model
│ └── storage/
│ └── db/ # SQLite database files
├── main.py # FastAPI application entry point
├── requirements.txt # Project dependencies
└── README.md # Project documentation
Database Schema
Todo
Column | Type | Description |
---|---|---|
id | Integer | Primary key |
title | String | Todo title |
description | String | Todo description (optional) |
completed | Boolean | Todo completion status |
created_at | DateTime | Creation timestamp |
updated_at | DateTime | Last update timestamp |
Description
Languages
Python
95.1%
Mako
4.9%