
- Set up project structure with FastAPI - Create SQLite database models with SQLAlchemy - Implement Alembic for migrations - Create API endpoints for todo operations - Add health check endpoint - Update README.md with comprehensive documentation generated with BackendIM... (backend.im)
Simple Todo Application
A simple todo application built with FastAPI and SQLite.
Features
- Create, read, update, and delete todo items
- SQLite database with SQLAlchemy ORM
- Alembic migrations
- FastAPI with automatic OpenAPI documentation
Project Structure
simpletodoapplication/
├── alembic/ # Database migrations
│ └── versions/ # Migration scripts
├── app/ # Application code
│ ├── api/ # API routes
│ ├── core/ # Core configuration
│ ├── db/ # Database setup
│ ├── models/ # SQLAlchemy models
│ └── schemas/ # Pydantic schemas
├── storage/ # Storage directory
│ └── db/ # Database files
├── alembic.ini # Alembic configuration
├── main.py # Application entry point
├── README.md # This file
└── requirements.txt # Project dependencies
Installation
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
Running the Application
- Run database migrations:
alembic upgrade head
- Start the application:
uvicorn main:app --reload
- Open your browser and navigate to:
- API Documentation: http://localhost:8000/docs
- Redoc Documentation: http://localhost:8000/redoc
- Health Check: http://localhost:8000/health
API Endpoints
GET /health
: Health check endpointPOST /api/todos/
: Create a new todoGET /api/todos/
: Get all todosGET /api/todos/{todo_id}
: Get a specific todoPUT /api/todos/{todo_id}
: Update a todoDELETE /api/todos/{todo_id}
: Delete a todo
Database Migrations
To create a new migration:
alembic revision -m "your migration message"
To upgrade to the latest migration:
alembic upgrade head
To downgrade the last migration:
alembic downgrade -1
Description
Languages
Python
94.2%
Mako
5.8%