Automated Action af063c97fc Create Todo app with FastAPI and SQLite
- Set up project structure with FastAPI and SQLAlchemy
- Create Todo model with CRUD operations
- Implement database migrations with Alembic
- Add health endpoint and API documentation
- Create comprehensive README

generated with BackendIM... (backend.im)
2025-05-13 17:36:33 +00:00

108 lines
2.2 KiB
Markdown

# Simple Todo App
A simple Todo application built with FastAPI and SQLite.
## Features
- Create, read, update, and delete todo items
- SQLite database with SQLAlchemy ORM
- Alembic migrations for database version control
- API documentation using FastAPI's built-in Swagger UI and ReDoc
## Project Structure
```
simpletodoapp/
├── app/
│ ├── api/
│ │ ├── __init__.py
│ │ └── routes.py
│ ├── db/
│ │ ├── __init__.py
│ │ ├── database.py
│ │ └── models.py
│ ├── schemas/
│ │ ├── __init__.py
│ │ └── todo.py
│ ├── services/
│ │ ├── __init__.py
│ │ └── todo.py
│ └── __init__.py
├── migrations/
│ ├── versions/
│ │ └── 1f87c1e94e6a_create_todos_table.py
│ ├── env.py
│ └── script.py.mako
├── alembic.ini
├── main.py
├── README.md
└── requirements.txt
```
## Prerequisites
- Python 3.7+
- pip
## 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 the dependencies:
```bash
pip install -r requirements.txt
```
## Database Setup
The application uses SQLite for the database, and migrations are handled with Alembic.
1. Run the migrations to set up the database:
```bash
alembic upgrade head
```
## Running the Application
To run the application:
```bash
uvicorn main:app --reload
```
The API will be available at http://localhost:8000.
## API Documentation
After running the application, you can view the API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
## API Endpoints
- `GET /api/todos/`: Get all todos
- `GET /api/todos/{todo_id}`: Get a specific todo
- `POST /api/todos/`: Create a new todo
- `PUT /api/todos/{todo_id}`: Update a todo
- `DELETE /api/todos/{todo_id}`: Delete a todo
- `GET /health`: Check the application health
## License
This project is licensed under the MIT License.