Automated Action 43ed4aaa3f Create simple todo application with FastAPI and SQLite
- Set up project structure with FastAPI and SQLite
- Created Todo model with SQLAlchemy ORM
- Added CRUD operations for todos
- Implemented API endpoints for Todo operations
- Added health check endpoint
- Added Alembic for database migrations
- Updated README with documentation

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

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

  1. Clone the repository:
git clone [repository-url]
cd simpletodoapplication
  1. Install dependencies:
pip install -r requirements.txt
  1. 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 todos
  • POST /api/todos/ - Create a new todo
  • GET /api/todos/{todo_id} - Get a specific todo
  • PUT /api/todos/{todo_id} - Update a todo
  • DELETE /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
Project: Simple Todo Application
Readme 36 KiB
Languages
Python 95.1%
Mako 4.9%