Todo App API

This is a simple Todo application backend built with FastAPI and SQLite.

Features

  • Create, read, update, and delete Todo items
  • Filter Todos by completion status
  • RESTful API with proper status codes
  • SQLite database with SQLAlchemy ORM
  • Database migrations with Alembic
  • Input validation with Pydantic
  • CORS support
  • Health check endpoint

Requirements

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

Installation

  1. Clone the repository:
git clone <repository-url>
cd todoappbackend-uspc3m
  1. Install dependencies:
pip install -r requirements.txt

Configuration

The application uses environment variables for configuration. You can create a .env file in the root directory with the following settings:

PROJECT_NAME=Todo App API

Database Setup

The application uses SQLite by default. The database file will be created at /app/storage/db/db.sqlite.

To initialize the database:

# Run the database migrations
alembic upgrade head

Running the Application

# Development server
uvicorn main:app --reload

# Production server
uvicorn main:app --host 0.0.0.0 --port 8000

API Documentation

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

API Endpoints

  • GET /api/v1/todos: Get all todos (with optional filtering)
  • 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
  • GET /health: Health check endpoint

Development

Linting

ruff check .

Fix linting issues

ruff check --fix .
Description
Project: Todo App Backend
Readme 38 KiB
Languages
Python 95.2%
Mako 4.8%