86 lines
1.8 KiB
Markdown

# Simple Todo App
This is a simple Todo API application built with FastAPI and SQLite.
## Features
- Create, Read, Update, and Delete Todo items
- Health check endpoint
- Database migrations using Alembic
- SQLite database for data storage
## Project Structure
```
.
├── alembic/ # Database migration files
├── app/ # Application package
│ ├── database/ # Database configuration and session management
│ ├── models/ # SQLAlchemy ORM models
│ ├── routers/ # API route handlers
│ └── schemas/ # Pydantic models for request/response validation
├── alembic.ini # Alembic configuration
├── main.py # Application entry point
└── requirements.txt # Project dependencies
```
## Installation
1. Clone the repository:
```bash
git clone <repository-url>
cd simpletodoapp
```
2. Create a virtual environment and activate it:
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
3. Install dependencies:
```bash
pip install -r requirements.txt
```
## Database Setup
1. Run database migrations:
```bash
alembic upgrade head
```
## Running the Application
Start the application with Uvicorn:
```bash
uvicorn main:app --reload
```
The API will be available at http://localhost:8000
## API Documentation
Once the application is running, you can access the Swagger UI documentation at:
- http://localhost:8000/docs
- http://localhost:8000/redoc
## API Endpoints
### Health Check
- GET `/health`: Check the application health status
### Todo Endpoints
- GET `/todos`: List all todos
- POST `/todos`: Create a new todo
- GET `/todos/{todo_id}`: Get a specific todo by ID
- PATCH `/todos/{todo_id}`: Update a specific todo
- DELETE `/todos/{todo_id}`: Delete a specific todo