
- Implement Todo database model with SQLAlchemy - Set up Alembic for database migrations - Create CRUD operations for Todo items - Implement RESTful API endpoints - Add health check endpoint - Include comprehensive README with usage instructions
108 lines
2.1 KiB
Markdown
108 lines
2.1 KiB
Markdown
# Simple Todo App
|
|
|
|
A simple Todo application API built with FastAPI and SQLite.
|
|
|
|
## Features
|
|
|
|
- Create, read, update, and delete Todo items
|
|
- SQLite database with SQLAlchemy ORM
|
|
- Alembic migrations for database versioning
|
|
- API documentation with Swagger UI
|
|
- Health check endpoint
|
|
|
|
## Requirements
|
|
|
|
- Python 3.7+
|
|
- FastAPI
|
|
- SQLAlchemy
|
|
- Alembic
|
|
- Uvicorn
|
|
- Ruff (for linting)
|
|
|
|
## Installation
|
|
|
|
1. Clone the repository:
|
|
|
|
```bash
|
|
git clone https://github.com/yourusername/simpletodoapp.git
|
|
cd simpletodoapp
|
|
```
|
|
|
|
2. Install dependencies:
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
3. Run migrations:
|
|
|
|
```bash
|
|
alembic upgrade head
|
|
```
|
|
|
|
## Running the Application
|
|
|
|
Start the application with:
|
|
|
|
```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 interactive API documentation at:
|
|
|
|
- Swagger UI: http://localhost:8000/docs
|
|
- ReDoc: http://localhost:8000/redoc
|
|
|
|
## API Endpoints
|
|
|
|
### Todo Endpoints
|
|
|
|
- `GET /api/todos` - Get all todos
|
|
- `POST /api/todos` - Create a new todo
|
|
- `GET /api/todos/{todo_id}` - Get a specific todo
|
|
- `PATCH /api/todos/{todo_id}` - Update a todo
|
|
- `DELETE /api/todos/{todo_id}` - Delete a todo
|
|
|
|
### Health Check
|
|
|
|
- `GET /health` - Check API health status
|
|
|
|
## Database
|
|
|
|
The application uses SQLite as the database with SQLAlchemy as the ORM. The database file is stored at `/app/storage/db/db.sqlite`.
|
|
|
|
## Development
|
|
|
|
### Linting
|
|
|
|
```bash
|
|
ruff check .
|
|
ruff check --fix .
|
|
```
|
|
|
|
### Running Tests
|
|
|
|
```bash
|
|
# No tests implemented yet
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
simpletodoapp/
|
|
├── app/
|
|
│ ├── crud/ # CRUD operations
|
|
│ ├── models/ # SQLAlchemy models
|
|
│ ├── routers/ # API endpoints
|
|
│ ├── schemas/ # Pydantic schemas
|
|
│ └── database.py # Database configuration
|
|
├── migrations/ # Alembic migrations
|
|
├── main.py # Application entry point
|
|
├── alembic.ini # Alembic configuration
|
|
├── requirements.txt # Dependencies
|
|
└── README.md # Project documentation
|
|
``` |