Automated Action 3bed1d0510 Create Todo API with FastAPI and SQLite
- Implement Todo CRUD API endpoints
- Set up SQLite database with SQLAlchemy
- Create Todo model and schemas
- Configure Alembic migrations
- Add comprehensive documentation

🤖 Generated with and Co-Authored by [BackendIM](https://backend.im)
2025-05-11 18:30:32 +00:00

2.0 KiB

Todo Backend Service API

This is a RESTful API for a Todo application built with FastAPI and SQLite. The API allows users to create, read, update, and delete todo items.

Features

  • CRUD operations for todo items
  • Filtering todos by completion status
  • SQLite database with SQLAlchemy ORM
  • Alembic migrations
  • API documentation with Swagger UI and ReDoc

Project Structure

todobackendservice/
├── alembic/             # Database migrations
├── app/                 # Application package
│   ├── api/             # API endpoints
│   ├── core/            # Core functionality, configs
│   ├── db/              # Database session, dependencies
│   ├── models/          # SQLAlchemy models
│   ├── schemas/         # Pydantic schemas
│   └── storage/         # Storage directory for SQLite
├── main.py              # Application entry point
├── alembic.ini          # Alembic configuration
└── requirements.txt     # Project dependencies

Getting Started

Prerequisites

  • Python 3.8 or higher
  • pip (Python package installer)

Installation

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

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

API Documentation

The API documentation is available at:

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

API Endpoints

Todos

  • 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

Query Parameters

  • skip - Number of records to skip (default: 0)
  • limit - Maximum number of records to return (default: 100)
  • completed - Filter by completion status (optional)