
- Create project structure with FastAPI setup - Implement Todo model with SQLAlchemy - Set up database migrations with Alembic - Create CRUD API endpoints for Todo items - Add health endpoint for application monitoring - Update README with documentation generated with BackendIM... (backend.im)
1.7 KiB
1.7 KiB
Simple Todo Application
A RESTful API for a Todo application built with FastAPI and SQLite.
Features
- Create, Read, Update, and Delete Todo items
- Health endpoint for application monitoring
- SQLite database with SQLAlchemy ORM
- Database migrations with Alembic
API Endpoints
- GET /health: Check application health
- GET /api/v1/todos: List all todos
- POST /api/v1/todos: Create a new todo
- GET /api/v1/todos/{id}: Get a specific todo by ID
- PUT /api/v1/todos/{id}: Update a todo
- DELETE /api/v1/todos/{id}: Delete a todo
Getting Started
Prerequisites
- Python 3.8 or higher
- FastAPI
- SQLAlchemy
- Alembic
Installation
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
- Run database migrations:
alembic upgrade head
- Start the server:
uvicorn main:app --reload
API Documentation
API documentation is automatically generated and available at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
Project Structure
.
├── alembic/ # Database migration files
├── app/ # Application package
│ ├── api/ # API routes
│ │ └── endpoints/ # API endpoint modules
│ ├── core/ # Core functionality
│ ├── db/ # Database setup
│ ├── models/ # SQLAlchemy models
│ └── schemas/ # Pydantic schemas
├── main.py # Application entry point
├── alembic.ini # Alembic configuration
└── requirements.txt # Project dependencies