Simple Todo App
A simple Todo application backend built with FastAPI and SQLite.
Features
- CRUD operations for Todo items
- SQLite database with SQLAlchemy ORM
- Alembic for database migrations
- Health check endpoint
- OpenAPI documentation
Prerequisites
- Python 3.8+
- pip
Installation
- Clone the repository:
git clone <repository-url>
cd simpletodoapp-t3firn
- Install the dependencies:
pip install -r requirements.txt
- Run database migrations:
alembic upgrade head
Usage
Start the application with:
uvicorn main:app --reload
The API will be available at http://localhost:8000
API Documentation
OpenAPI documentation is available at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
API Endpoints
Endpoint | Method | Description |
---|---|---|
/api/v1/todos |
GET | List all todos |
/api/v1/todos/{id} |
GET | Get a specific todo by ID |
/api/v1/todos |
POST | Create a new todo |
/api/v1/todos/{id} |
PUT | Update an existing todo |
/api/v1/todos/{id} |
DELETE | Delete a todo |
/health |
GET | Health check endpoint |
Todo Item Structure
{
"id": 1,
"title": "Task title",
"description": "Task description",
"completed": false,
"created_at": "2023-12-01T12:00:00",
"updated_at": "2023-12-01T12:00:00"
}
Database Schema
The application uses a SQLite database with the following schema:
Todos Table
Column | Type | Constraints |
---|---|---|
id | Integer | Primary Key, Auto Increment |
title | String | Not Null, Indexed |
description | String | Nullable |
completed | Boolean | Default: False |
created_at | DateTime | Not Null |
updated_at | DateTime | Not Null |
Description
Languages
Python
96%
Mako
4%