2025-05-17 03:24:28 +00:00

78 lines
2.8 KiB
Markdown

# Simple Todo App
A simple Todo API built with FastAPI and SQLite.
## Features
- Create, read, update and delete Todo items
- Filter todos by completion status
- Health check endpoint to verify API and database status
- API documentation with Swagger UI and ReDoc
## Requirements
- Python 3.8+
- FastAPI
- SQLAlchemy
- Alembic (for database migrations)
- Uvicorn (ASGI server)
- SQLite
## Project Structure
```
.
├── alembic.ini # Alembic configuration file
├── app/ # Application package
│ ├── api/ # API endpoints
│ │ ├── deps.py # API dependencies
│ │ ├── health.py # Health check endpoint
│ │ └── v1/ # API version 1
│ │ ├── api.py # API router
│ │ └── endpoints/ # API endpoints by resource
│ │ └── todos.py # Todo CRUD operations
│ ├── core/ # Core modules
│ │ └── config.py # Application configuration
│ ├── db/ # Database related code
│ │ └── session.py # Database session
│ ├── models/ # SQLAlchemy models
│ │ └── todo.py # Todo model
│ ├── schemas/ # Pydantic schemas
│ │ └── todo.py # Todo schemas
│ └── storage/ # Storage directory
│ └── db/ # Database files
├── main.py # Application entry point
├── migrations/ # Alembic migrations
│ ├── env.py # Migration environment
│ ├── script.py.mako # Migration script template
│ └── versions/ # Migration versions
│ └── initial_migration.py # Initial migration
├── pyproject.toml # Project configuration for tools
└── requirements.txt # Python dependencies
```
## Quick Start
1. Clone the repository
2. Create a virtual environment: `python -m venv venv`
3. Activate the virtual environment: `source venv/bin/activate` (Linux/Mac) or `venv\Scripts\activate` (Windows)
4. Install dependencies: `pip install -r requirements.txt`
5. Run the application: `uvicorn main:app --reload`
The API will be available at http://localhost:8000
## API Documentation
Once the application is running, you can access:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
## API Endpoints
- **GET /api/v1/todos**: List all todos
- **POST /api/v1/todos**: Create a new todo
- **GET /api/v1/todos/{todo_id}**: Get a specific todo
- **PATCH /api/v1/todos/{todo_id}**: Update a todo
- **DELETE /api/v1/todos/{todo_id}**: Delete a todo
- **GET /health**: Health check endpoint
- **GET /**: Root endpoint with welcome message