Automated Action 7e35149610 Create simple todo application with FastAPI and SQLite
- Set up FastAPI project structure with proper organization
- Create Todo model with SQLAlchemy ORM
- Set up Alembic for database migrations
- Create CRUD operations and API endpoints for todos
- Add health check endpoint
- Update README with comprehensive documentation

generated with BackendIM... (backend.im)
2025-05-13 03:51:03 +00:00

Simple Todo Application - FastAPI

A simple Todo API application built with FastAPI and SQLite. This RESTful API provides endpoints to create, read, update, and delete todo items.

Features

  • RESTful API for Todo management
  • CRUD operations for Todo items
  • SQLAlchemy ORM with SQLite database
  • Alembic for database migrations
  • FastAPI's automatic OpenAPI documentation

Project Structure

simpletodoapplication/
├── alembic/                  # Database migrations
│   ├── versions/             # Migration scripts
│   └── env.py                # Alembic environment configuration
├── app/                      # Application package
│   ├── api/                  # API routes
│   │   └── routes/           # Route definitions
│   │       └── todos.py      # Todo routes
│   ├── core/                 # Core modules
│   │   └── config.py         # Application configuration
│   ├── crud/                 # CRUD operations
│   │   └── todo.py           # Todo CRUD operations
│   ├── db/                   # Database setup
│   │   └── base.py           # Database connection
│   ├── 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

API Endpoints

  • GET /api/v1/todos/ - Get 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
  • GET /health - Health check endpoint
  • GET /docs - API documentation (Swagger UI)
  • GET /redoc - Alternative API documentation (ReDoc)

Setup and Running

  1. Install dependencies:

    pip install -r requirements.txt
    
  2. Apply migrations:

    alembic upgrade head
    
  3. Run the application:

    uvicorn main:app --reload
    
  4. Access the API documentation at:

    http://localhost:8000/docs
    

Todo Object Structure

{
  "id": 1,
  "title": "Sample Todo",
  "description": "This is a sample todo item",
  "completed": false,
  "created_at": "2025-05-13T12:00:00",
  "updated_at": null
}
Description
Project: Simple Todo Application
Readme 56 KiB
Languages
Python 97.3%
Mako 2.7%