Simple Todo Application

A simple todo application API built with FastAPI and SQLite.

Features

  • Create, read, update, and delete todo items
  • Health check endpoint
  • API documentation
  • Database migrations with Alembic

Project Structure

/
├── alembic/              # Database migration scripts
├── app/                  # Application code
│   ├── api/              # API endpoints
│   │   ├── endpoints/    # API endpoint implementations
│   │   │   ├── health.py # Health check endpoint
│   │   │   └── todos.py  # Todo endpoints
│   │   └── routes.py     # API router configuration
│   ├── core/             # Core application code
│   │   └── config.py     # Application configuration
│   ├── db/               # Database configuration
│   │   └── database.py   # Database connection setup
│   ├── models/           # SQLAlchemy models
│   │   └── todo.py       # Todo model
│   └── schemas/          # Pydantic schemas
│       └── todo.py       # Todo schemas
├── alembic.ini           # Alembic configuration
├── main.py               # Application entry point
└── requirements.txt      # Project dependencies

Getting Started

Prerequisites

  • Python 3.8 or higher

Installation

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

Database Setup

  1. Run database 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 API documentation at:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

API Endpoints

  • GET /api/v1/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
Description
Project: Simple Todo Application
Readme 52 KiB
Languages
Python 95.6%
Mako 4.4%