
- Set up project structure - Create FastAPI app with SQLite database - Implement Todo API with CRUD operations - Set up Alembic for database migrations - Add health endpoint - Create README with documentation
FastAPI Todo Application
This is a FastAPI application bootstrapped by BackendIM, the AI-powered backend generation platform. The application provides a RESTful API for managing todo items.
Features
- RESTful API for CRUD operations on todo items
- FastAPI with automatic API documentation
- SQLite database with SQLAlchemy ORM
- Alembic for database migrations
- Health check endpoint
- CORS support
Project Structure
todoapp/
├── alembic.ini
├── app/
│ ├── __init__.py
│ ├── api/
│ │ ├── __init__.py
│ │ └── v1/
│ │ ├── __init__.py
│ │ ├── api.py
│ │ ├── health.py
│ │ └── todos.py
│ ├── core/
│ │ ├── config.py
│ │ └── database.py
│ ├── models/
│ │ ├── __init__.py
│ │ └── todo.py
│ └── schemas/
│ ├── __init__.py
│ └── todo.py
├── main.py
├── migrations/
│ ├── README
│ ├── env.py
│ ├── script.py.mako
│ └── versions/
│ └── 9c42f1a4a5a7_create_todos_table.py
└── requirements.txt
Installation
- Clone the repository:
git clone <repository-url>
cd todoapp
- Install dependencies:
pip install -r requirements.txt
- Run migrations to create the database:
alembic upgrade head
Running the Application
Start the application with:
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
The API will be available at http://localhost:8000. You can access the API documentation at http://localhost:8000/docs.
API Endpoints
- GET /api/v1/todos: Get all todos
- POST /api/v1/todos: Create a new todo
- GET /api/v1/todos/{todo_id}: Get a specific todo
- PUT /api/v1/todos/{todo_id}: Update a specific todo
- DELETE /api/v1/todos/{todo_id}: Delete a specific todo
- GET /health: Health check endpoint
Development
- The database is stored at
/app/storage/db/db.sqlite
- Use Alembic to manage database migrations
- The API has CORS enabled for development purposes
License
MIT
Description
Languages
Python
95.3%
Mako
4.7%