2025-05-16 01:35:23 +00:00

1.8 KiB

Simple Todo Application API

This is a REST API for a simple todo application built with FastAPI and SQLite.

Features

  • Create, read, update, and delete todo items
  • Health endpoint for application monitoring
  • API documentation via Swagger UI and ReDoc
  • Database migrations using Alembic
  • SQLite database for data storage

Project Structure

├── app/
│   ├── api/           # API endpoints
│   ├── crud/          # Database CRUD operations
│   ├── db/            # Database connection and utilities
│   ├── models/        # SQLAlchemy models
│   └── schemas/       # Pydantic schemas
├── migrations/        # Alembic migration scripts
├── main.py            # FastAPI application entry point
├── alembic.ini        # Alembic configuration
└── requirements.txt   # Project dependencies

Installation

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

Running the Application

Start the application with:

uvicorn main:app --reload

The API will be available at http://localhost:8000

API Documentation

API Endpoints

  • GET /: Root endpoint with API information
  • GET /health: Health check endpoint
  • GET /todos: Get all todo items
  • POST /todos: Create a new todo item
  • GET /todos/{id}: Get a specific todo item
  • PATCH /todos/{id}: Update a todo item
  • DELETE /todos/{id}: Delete a todo item

Database Migrations

Run migrations with:

alembic upgrade head

Development

This project uses Ruff for linting. Run the linter with:

ruff check .

To automatically fix issues:

ruff check --fix .