
- Created FastAPI application with CRUD endpoints for todos - Set up SQLAlchemy with SQLite database - Created database models and Pydantic schemas - Added Alembic for database migrations - Added health check endpoint - Updated README with project information generated with BackendIM... (backend.im)
Simple Todo App
This is a simple Todo API built with FastAPI and SQLite.
Features
- Create, read, update, and delete todo items
- Health check endpoint
- SQLite database with SQLAlchemy ORM
- Alembic for database migrations
Project Structure
simpletodoapp/
│
├── alembic/ # Database migrations
│ ├── versions/ # Migration versions
│ ├── env.py # Alembic environment configuration
│ └── script.py.mako # Migration script template
│
├── app/ # Application package
│ ├── __init__.py
│ ├── crud.py # CRUD operations
│ ├── database.py # Database setup and connection
│ ├── models.py # SQLAlchemy models
│ └── schemas.py # Pydantic schemas for API
│
├── alembic.ini # Alembic configuration
├── main.py # FastAPI application and endpoints
└── requirements.txt # Python dependencies
API Endpoints
GET /health
- Health check endpointGET /todos
- Get all todosPOST /todos
- Create a new todoGET /todos/{todo_id}
- Get a specific todoPUT /todos/{todo_id}
- Update a todoDELETE /todos/{todo_id}
- Delete a todo
Getting Started
-
Install dependencies:
pip install -r requirements.txt
-
Run database migrations:
alembic upgrade head
-
Start the application:
uvicorn main:app --reload
-
Access the API documentation at http://localhost:8000/docs
Todo Item Schema
{
"id": 1,
"title": "Task title",
"description": "Task description",
"completed": false,
"created_at": "2023-01-01T00:00:00",
"updated_at": "2023-01-01T00:00:00"
}
Description
Languages
Python
94.5%
Mako
5.5%