Automated Action 0d888832b4 Create simple todo app with FastAPI and SQLite
- Set up project structure and FastAPI application
- Create database models with SQLAlchemy
- Set up Alembic for database migrations
- Create API endpoints for todo CRUD operations
- Add health check endpoint
- Add unit tests for API endpoints
- Configure Ruff for linting and formatting
2025-05-22 10:47:24 +00:00
2025-05-22 10:40:48 +00:00

Simple Todo App

This is a FastAPI-based Todo application with SQLite as the database backend. The application provides a REST API for managing todo items.

Features

  • Create, read, update, and delete todo items
  • SQLite database for data persistence
  • Alembic for database migrations
  • Health check endpoint
  • API documentation with Swagger UI and ReDoc

Project Structure

├── alembic.ini                # Alembic configuration
├── app                        # Application package
│   ├── api                    # API routes
│   │   ├── api.py             # Main API router
│   │   └── endpoints          # API endpoints
│   │       └── todos.py       # Todo endpoints
│   ├── core                   # Core functionality
│   │   └── config.py          # Application configuration
│   ├── db                     # Database related modules
│   │   └── session.py         # Database session management
│   ├── models                 # SQLAlchemy models
│   │   └── todo.py            # Todo model
│   └── schemas                # Pydantic schemas
│       └── todo.py            # Todo schemas
├── main.py                    # Application entry point
├── migrations                 # Alembic migrations
│   ├── env.py                 # Alembic environment
│   ├── README                 # Migrations README
│   ├── script.py.mako         # Script template
│   └── versions               # Migration versions
│       └── 001_create_todos_table.py  # Initial migration
├── requirements.txt           # Project dependencies
└── tests                      # Tests
    └── test_api.py            # API tests

Getting Started

Prerequisites

  • Python 3.8 or higher

Installation

  1. Clone the repository

  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Run database migrations:

    alembic upgrade head
    
  4. Start the application:

    uvicorn main:app --reload
    
  5. Access the API documentation:

API Endpoints

Method Endpoint Description
GET /health Health check endpoint
GET /todos Get all todo items
GET /todos/{id} Get a specific todo item
POST /todos Create a new todo item
PUT /todos/{id} Update an existing todo item
DELETE /todos/{id} Delete a todo item

Testing

Run tests with pytest:

pytest

License

This project is licensed under the MIT License.

Description
Project: Simple Todo App
Readme 40 KiB
Languages
Python 96.6%
Mako 3.4%