Automated Action 10ef945a25 Build simple Todo application with FastAPI and SQLite
- Created REST API for managing todo items
- Implemented SQLite database with SQLAlchemy ORM
- Added Alembic for database migrations
- Added health check endpoint

generated with BackendIM... (backend.im)
2025-05-13 06:22:39 +00:00

83 lines
1.7 KiB
Markdown

# Simple Todo Application
A simple Todo API application built with FastAPI and SQLite.
## Features
- RESTful API for managing todo items
- SQLite database with SQLAlchemy ORM
- Alembic migrations for database versioning
- Health check endpoint
- Swagger UI documentation
## Project Structure
```
.
├── alembic.ini
├── app
│ ├── api
│ │ └── routes
│ │ ├── health.py
│ │ └── todos.py
│ ├── db
│ │ ├── database.py
│ │ └── init_db.py
│ ├── models
│ │ └── todo.py
│ └── schemas
│ └── todo.py
├── main.py
├── migrations
│ ├── README
│ ├── env.py
│ ├── script.py.mako
│ └── versions
│ └── initial_migration.py
└── requirements.txt
```
## Installation
1. Clone the repository
2. Install the dependencies:
```bash
pip install -r requirements.txt
```
## Running the Application
```bash
uvicorn main:app --reload
```
The application will be available at http://localhost:8000.
API Documentation is available at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
## API Endpoints
### Health Check
- `GET /health` - Check API health
### Todo Operations
- `GET /todos` - List all todos
- `POST /todos` - Create a new todo
- `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 with SQLAlchemy ORM. The database file is stored at `/app/storage/db/db.sqlite`.
## Migrations
This project uses Alembic for database migrations. To run migrations:
```bash
alembic upgrade head
```