Todo App API

A simple Todo app API built with FastAPI and SQLite.

Features

  • CRUD operations for todo items
  • SQLAlchemy ORM for database interactions
  • Alembic for database migrations
  • Pydantic for data validation
  • Health check endpoint
  • FastAPI automatic documentation with Swagger UI and ReDoc

Project Structure

/
├── app/                  # Application package
│   ├── api/              # API endpoints
│   │   ├── deps.py       # Dependencies
│   │   └── endpoints/    # API routes
│   ├── core/             # Core modules
│   │   └── config.py     # Configuration
│   ├── crud/             # CRUD operations
│   ├── db/               # Database setup
│   ├── models/           # SQLAlchemy models
│   └── schemas/          # Pydantic schemas
├── migrations/           # Alembic migrations
├── alembic.ini           # Alembic config
├── main.py               # Application entry point
└── requirements.txt      # Dependencies

Getting Started

Prerequisites

  • Python 3.8 or higher

Installation

  1. Clone the repository:
git clone <repository-url>
cd todoapp
  1. Install dependencies:
pip install -r requirements.txt
  1. Run database migrations:
alembic upgrade head
  1. Start the application:
uvicorn main:app --reload

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

API Documentation

Once the application is running, you can access:

API Endpoints

  • GET /health - Health check endpoint
  • 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

Data Models

Todo

  • id: Integer (auto-generated)
  • title: String (required)
  • description: String (optional)
  • completed: Boolean (default: false)
  • priority: Integer (0=low, 1=medium, 2=high)
  • created_at: DateTime (auto-generated)
  • updated_at: DateTime (auto-updated)
Description
Project: Todo App
Readme 40 KiB
Languages
Python 96%
Mako 4%