todoapp-kcnfku/README.md
Automated Action 5fbf8c4171 Create simple Todo app with FastAPI and SQLite
- Setup project structure with FastAPI
- Create Todo model and database schemas
- Implement CRUD operations for Todo items
- Create API endpoints for Todo operations
- Add health check endpoint
- Configure Alembic for database migrations
- Add detailed documentation in README.md
2025-05-27 16:58:01 +00:00

87 lines
2.4 KiB
Markdown

# Todo App API
A simple Todo app API built with FastAPI and SQLite. This project provides a RESTful API for managing todo items.
## Features
- CRUD operations for todo items (Create, Read, Update, Delete)
- Filter todos by priority (low, medium, high) and completion status
- SQLite database with SQLAlchemy ORM
- Database migrations with Alembic
- API documentation with Swagger UI and ReDoc
## Project Structure
```
├── app/
│ ├── api/ # API endpoints
│ │ └── v1/ # API version 1
│ │ └── endpoints/
│ │ └── todos.py
│ ├── core/ # Core application settings
│ │ └── config.py
│ ├── crud/ # Database CRUD operations
│ │ ├── base.py
│ │ └── crud_todo.py
│ ├── db/ # Database setup
│ │ ├── base.py
│ │ ├── base_class.py
│ │ └── session.py
│ ├── models/ # SQLAlchemy models
│ │ └── todo.py
│ └── schemas/ # Pydantic schemas
│ └── todo.py
├── migrations/ # Alembic migrations
│ └── versions/
│ └── 0001_create_todo_table.py
├── .env # Environment variables
├── alembic.ini # Alembic configuration
├── main.py # Application entry point
└── requirements.txt # Python dependencies
```
## Getting Started
### Prerequisites
- Python 3.8+
### Installation
1. Clone the repository
2. Install dependencies:
```
pip install -r requirements.txt
```
3. Run the application:
```
uvicorn main:app --reload
```
## API Endpoints
- `GET /api/v1/todos`: List all todos (with optional filtering)
- `POST /api/v1/todos`: Create a new todo
- `GET /api/v1/todos/{todo_id}`: Get a specific todo
- `PUT /api/v1/todos/{todo_id}`: Update a todo
- `DELETE /api/v1/todos/{todo_id}`: Delete a todo
- `GET /health`: Health check endpoint
- `GET /docs`: API documentation (Swagger UI)
- `GET /redoc`: API documentation (ReDoc)
## Database Migrations
To apply migrations:
```
alembic upgrade head
```
## Environment Variables
Configuration via environment variables in `.env` file:
- `PROJECT_NAME`: Name of the project
- `PROJECT_DESCRIPTION`: Description of the project
- `PROJECT_VERSION`: Version of the project
- `BACKEND_CORS_ORIGINS`: List of allowed CORS origins