
- 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)
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
- Clone the repository:
git clone <repository-url>
cd simpletodoapp
- Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install the dependencies:
pip install -r requirements.txt
Database Setup
The application uses SQLite for the database, and migrations are handled with Alembic.
- Run the migrations to set up the database:
alembic upgrade head
Running the Application
To run the application:
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 todosGET /api/todos/{todo_id}
: Get a specific todoPOST /api/todos/
: Create a new todoPUT /api/todos/{todo_id}
: Update a todoDELETE /api/todos/{todo_id}
: Delete a todoGET /health
: Check the application health
License
This project is licensed under the MIT License.
Description
Languages
Python
94.7%
Mako
5.3%