Automated Action 7fa5fb0213 Setup complete Todo API with FastAPI and SQLite
- Create Todo model and schemas
- Set up API endpoints for CRUD operations
- Configure SQLAlchemy for database access
- Set up Alembic for database migrations
- Add Ruff for code linting
- Update README with project documentation
2025-05-27 06:32:35 +00:00
2025-05-27 05:01:08 +00:00
2025-05-27 05:22:48 +00:00

Todo API

This is a FastAPI application for managing todo items.

Features

  • RESTful API for todo management
  • CRUD operations for todo items
  • SQLite database with SQLAlchemy ORM
  • Alembic for database migrations
  • Automatic API documentation with Swagger UI

Project Structure

todoapi/
├── alembic.ini              # Alembic configuration
├── app/                     # Application package
│   ├── api/                 # API routes
│   │   └── v1/              # API version 1
│   │       ├── api.py       # Main API router
│   │       └── endpoints/   # API endpoints
│   │           └── todos.py # Todo endpoints
│   ├── core/                # Core modules
│   │   └── config.py        # Application configuration
│   ├── crud/                # CRUD operations
│   │   └── todo.py          # Todo CRUD operations
│   ├── db/                  # Database modules
│   │   ├── base.py          # Base models module
│   │   ├── base_class.py    # Base model class
│   │   └── session.py       # Database session
│   ├── models/              # SQLAlchemy models
│   │   └── todo.py          # Todo model
│   └── schemas/             # Pydantic schemas
│       └── todo.py          # Todo schemas
├── main.py                  # Main application entry point
├── migrations/              # Alembic migrations
│   ├── env.py               # Migrations environment
│   ├── README               # Migrations README
│   ├── script.py.mako       # Migrations script template
│   └── versions/            # Migration versions
│       └── initial_migration.py # Initial migration
├── pyproject.toml           # Project configuration
├── README.md                # This file
└── requirements.txt         # Project dependencies

Installation

  1. Clone the repository:
git clone <repository-url>
cd todoapi
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the application:
uvicorn main:app --reload

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

API Documentation

API Endpoints

Todo Endpoints

  • GET /api/v1/todos - List all todos
  • POST /api/v1/todos - Create a new todo
  • GET /api/v1/todos/{todo_id} - Get a specific todo
  • PUT /api/v1/todos/{todo_id} - Update a todo
  • DELETE /api/v1/todos/{todo_id} - Delete a todo

Health Check

  • GET /health - Check if the API is running

Database Migrations

Apply migrations:

alembic upgrade head

Create a new migration:

alembic revision --autogenerate -m "description"

Development

Linting

This project uses Ruff for linting:

ruff check .

To automatically fix issues:

ruff check --fix .
Description
Project: Todo API
Readme 42 KiB
Languages
Python 96.1%
Mako 3.9%