2025-05-16 14:53:39 +00:00

93 lines
1.8 KiB
Markdown

# Simple Todo App
A simple Todo application backend built with FastAPI and SQLite.
## Features
- CRUD operations for Todo items
- SQLite database with SQLAlchemy ORM
- Alembic for database migrations
- Health check endpoint
- OpenAPI documentation
## Prerequisites
- Python 3.8+
- pip
## Installation
1. Clone the repository:
```bash
git clone <repository-url>
cd simpletodoapp-t3firn
```
2. Install the dependencies:
```bash
pip install -r requirements.txt
```
3. Run database migrations:
```bash
alembic upgrade head
```
## Usage
Start the application with:
```bash
uvicorn main:app --reload
```
The API will be available at http://localhost:8000
## API Documentation
OpenAPI documentation is available at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
## API Endpoints
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/api/v1/todos` | GET | List all todos |
| `/api/v1/todos/{id}` | GET | Get a specific todo by ID |
| `/api/v1/todos` | POST | Create a new todo |
| `/api/v1/todos/{id}` | PUT | Update an existing todo |
| `/api/v1/todos/{id}` | DELETE | Delete a todo |
| `/health` | GET | Health check endpoint |
## Todo Item Structure
```json
{
"id": 1,
"title": "Task title",
"description": "Task description",
"completed": false,
"created_at": "2023-12-01T12:00:00",
"updated_at": "2023-12-01T12:00:00"
}
```
## Database Schema
The application uses a SQLite database with the following schema:
### Todos Table
| Column | Type | Constraints |
|--------|------|-------------|
| id | Integer | Primary Key, Auto Increment |
| title | String | Not Null, Indexed |
| description | String | Nullable |
| completed | Boolean | Default: False |
| created_at | DateTime | Not Null |
| updated_at | DateTime | Not Null |