Automated Action 413eb37e87 Add simple todo app using FastAPI and SQLite
- Implement Todo database model with SQLAlchemy
- Set up Alembic for database migrations
- Create CRUD operations for Todo items
- Implement RESTful API endpoints
- Add health check endpoint
- Include comprehensive README with usage instructions
2025-05-17 21:39:34 +00:00

2.1 KiB

Simple Todo App

A simple Todo application API built with FastAPI and SQLite.

Features

  • Create, read, update, and delete Todo items
  • SQLite database with SQLAlchemy ORM
  • Alembic migrations for database versioning
  • API documentation with Swagger UI
  • Health check endpoint

Requirements

  • Python 3.7+
  • FastAPI
  • SQLAlchemy
  • Alembic
  • Uvicorn
  • Ruff (for linting)

Installation

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

Running the Application

Start the application with:

uvicorn main:app --reload

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

API Documentation

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

API Endpoints

Todo Endpoints

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

Health Check

  • GET /health - Check API health status

Database

The application uses SQLite as the database with SQLAlchemy as the ORM. The database file is stored at /app/storage/db/db.sqlite.

Development

Linting

ruff check .
ruff check --fix .

Running Tests

# No tests implemented yet

Project Structure

simpletodoapp/
├── app/
│   ├── crud/       # CRUD operations
│   ├── models/     # SQLAlchemy models
│   ├── routers/    # API endpoints
│   ├── schemas/    # Pydantic schemas
│   └── database.py # Database configuration
├── migrations/     # Alembic migrations
├── main.py         # Application entry point
├── alembic.ini     # Alembic configuration
├── requirements.txt # Dependencies
└── README.md       # Project documentation