Automated Action 0976677a4c Build Todo application with FastAPI and SQLite
- Set up project structure with FastAPI and SQLAlchemy
- Create Todo model, schemas, and CRUD operations
- Add API endpoints for todo operations (create, read, update, delete)
- Set up Alembic for database migrations
- Add health check endpoint
- Update README with detailed instructions

generated with BackendIM... (backend.im)
2025-05-13 12:38:16 +00:00

Simple Todo Application

A simple Todo application API built with FastAPI, SQLAlchemy, and SQLite.

Features

  • Create, read, update, and delete todo items
  • Filter todos by completion status
  • Pagination support
  • Health check endpoint

Project Structure

simpletodoapplication/
├── app/
│   ├── __init__.py
│   ├── crud.py         # CRUD operations
│   ├── database.py     # Database configuration
│   ├── models.py       # SQLAlchemy models
│   └── schemas.py      # Pydantic schemas
├── migrations/         # Alembic migrations
├── alembic.ini         # Alembic configuration
├── main.py             # FastAPI application
└── requirements.txt    # Project dependencies

Installation

  1. Clone the repository
  2. Install dependencies:
pip install -r requirements.txt

Database Setup

The application uses SQLite, and the database will be created automatically at /app/storage/db/db.sqlite when the application starts.

Running the Application

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:

API Endpoints

Health Check

  • GET /health - Check if the API is running

Todo Operations

  • GET /todos/ - List all todos (supports pagination and filtering by completion status)
  • POST /todos/ - Create a new todo
  • GET /todos/{todo_id} - Get a specific todo
  • PUT /todos/{todo_id} - Update a todo
  • DELETE /todos/{todo_id} - Delete a todo

Example Usage

Create a Todo

curl -X 'POST' \
  'http://localhost:8000/todos/' \
  -H 'Content-Type: application/json' \
  -d '{
  "title": "Buy groceries",
  "description": "Milk, bread, eggs"
}'

List All Todos

curl -X 'GET' 'http://localhost:8000/todos/'

Get Completed Todos

curl -X 'GET' 'http://localhost:8000/todos/?completed=true'

Update a Todo

curl -X 'PUT' \
  'http://localhost:8000/todos/1' \
  -H 'Content-Type: application/json' \
  -d '{
  "completed": true
}'

Delete a Todo

curl -X 'DELETE' 'http://localhost:8000/todos/1'
Description
Project: Simple Todo Application
Readme 40 KiB
Languages
Python 94.6%
Mako 5.4%