2025-05-16 01:35:23 +00:00

82 lines
1.8 KiB
Markdown

# Simple Todo Application API
This is a REST API for a simple todo application built with FastAPI and SQLite.
## Features
- Create, read, update, and delete todo items
- Health endpoint for application monitoring
- API documentation via Swagger UI and ReDoc
- Database migrations using Alembic
- SQLite database for data storage
## Project Structure
```
├── app/
│ ├── api/ # API endpoints
│ ├── crud/ # Database CRUD operations
│ ├── db/ # Database connection and utilities
│ ├── models/ # SQLAlchemy models
│ └── schemas/ # Pydantic schemas
├── migrations/ # Alembic migration scripts
├── main.py # FastAPI application entry point
├── alembic.ini # Alembic configuration
└── requirements.txt # Project dependencies
```
## Installation
1. Clone the repository
2. Install the dependencies:
```bash
pip install -r requirements.txt
```
## Running the Application
Start the application with:
```bash
uvicorn main:app --reload
```
The API will be available at http://localhost:8000
## API Documentation
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
## API Endpoints
- `GET /`: Root endpoint with API information
- `GET /health`: Health check endpoint
- `GET /todos`: Get all todo items
- `POST /todos`: Create a new todo item
- `GET /todos/{id}`: Get a specific todo item
- `PATCH /todos/{id}`: Update a todo item
- `DELETE /todos/{id}`: Delete a todo item
## Database Migrations
Run migrations with:
```bash
alembic upgrade head
```
## Development
This project uses Ruff for linting. Run the linter with:
```bash
ruff check .
```
To automatically fix issues:
```bash
ruff check --fix .
```