Automated Action 512d53de73 Create simple Todo application with FastAPI and SQLite
- Created CRUD operations for todos
- Added database models and SQLAlchemy integration
- Set up Alembic for database migrations
- Added health endpoint
- Updated README with installation and usage instructions

generated with BackendIM... (backend.im)
2025-05-12 10:34:56 +00:00

Simple Todo Application

A simple Todo API built with FastAPI and SQLAlchemy using SQLite as the database.

Features

  • Todo CRUD operations (Create, Read, Update, Delete)
  • Health endpoint to check application status
  • Database migrations with Alembic
  • SQLite database storage

Requirements

  • Python 3.8+
  • FastAPI
  • SQLAlchemy
  • Alembic
  • Uvicorn

Installation

  1. Clone the repository
git clone https://github.com/yourusername/simpletodoapplication.git
cd simpletodoapplication
  1. Install dependencies
pip install -r requirements.txt
  1. Run migrations
alembic upgrade head

Running the Application

  1. Start the FastAPI server
uvicorn main:app --reload
  1. The API will be available at http://localhost:8000

API Documentation

Once the server is running, you can access the interactive API documentation:

API Endpoints

Health Check

  • GET /health - Check application and database health

Todo Operations

  • GET /api/todos - Get all todos
  • GET /api/todos/{id} - Get a specific todo by ID
  • POST /api/todos - Create a new todo
  • PUT /api/todos/{id} - Update an existing todo
  • DELETE /api/todos/{id} - Delete a todo

Data Model

Todo

  • id: integer (primary key)
  • title: string (required)
  • description: string (optional)
  • completed: boolean (default: false)
  • created_at: datetime
  • updated_at: datetime

Example Usage

Create a Todo

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

Get All Todos

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

Update a Todo

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

Delete a Todo

curl -X 'DELETE' 'http://localhost:8000/api/todos/1'
Description
Project: Simple Todo Application
Readme 36 KiB
Languages
Python 94.5%
Mako 5.5%