1.8 KiB
1.8 KiB
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
- Clone the repository
- Install the dependencies:
pip install -r requirements.txt
Running the Application
Start the application with:
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 informationGET /health
: Health check endpointGET /todos
: Get all todo itemsPOST /todos
: Create a new todo itemGET /todos/{id}
: Get a specific todo itemPATCH /todos/{id}
: Update a todo itemDELETE /todos/{id}
: Delete a todo item
Database Migrations
Run migrations with:
alembic upgrade head
Development
This project uses Ruff for linting. Run the linter with:
ruff check .
To automatically fix issues:
ruff check --fix .