Automated Action cdd4aec842 Build simple todo app with FastAPI and SQLite
- Created FastAPI application with CRUD operations for todos
- Implemented SQLite database with SQLAlchemy ORM
- Added Alembic for database migrations
- Set up CORS middleware for all origins
- Added health check endpoint at /health
- Created comprehensive API documentation
- Formatted code with Ruff linter
- Updated README with project information

Features:
- Create, read, update, delete todos
- Pagination support for listing todos
- Auto-generated OpenAPI documentation at /docs
- Health monitoring endpoint
2025-06-19 21:46:14 +00:00

69 lines
1.9 KiB
Markdown

# Todo App API
A simple Todo application API built with FastAPI and SQLite.
## Features
- Create, read, update, and delete todos
- SQLite database with SQLAlchemy ORM
- Database migrations with Alembic
- CORS enabled for all origins
- Health check endpoint
- Auto-generated API documentation
## Installation
1. Install dependencies:
```bash
pip install -r requirements.txt
```
2. Run the application:
```bash
uvicorn main:app --reload
```
The API will be available at http://localhost:8000
## API Endpoints
- `GET /` - Root endpoint with API information
- `GET /health` - Health check endpoint
- `GET /docs` - Interactive API documentation (Swagger UI)
- `GET /redoc` - Alternative API documentation
- `POST /todos` - Create a new todo
- `GET /todos` - Get all todos (with pagination)
- `GET /todos/{todo_id}` - Get a specific todo
- `PUT /todos/{todo_id}` - Update a todo
- `DELETE /todos/{todo_id}` - Delete a todo
## Database
The application uses SQLite database stored at `/app/storage/db/db.sqlite`. Database migrations are managed with Alembic.
## Project Structure
```
├── main.py # FastAPI application entry point
├── requirements.txt # Python dependencies
├── alembic.ini # Alembic configuration
├── alembic/ # Database migrations
│ ├── env.py
│ ├── script.py.mako
│ └── versions/
│ └── 001_create_todos_table.py
└── app/
├── __init__.py
├── schemas.py # Pydantic schemas
├── db/
│ ├── __init__.py
│ ├── base.py # SQLAlchemy base
│ └── session.py # Database session
├── models/
│ ├── __init__.py
│ └── todo.py # Todo model
└── routers/
├── __init__.py
└── todos.py # Todo API endpoints
```