2.0 KiB
2.0 KiB
Todo Application API
A Todo application backend built with Python, FastAPI, and SQLAlchemy.
Features
- Create, read, update, and delete todo items
- List all todos with pagination
- Persistent storage using SQLite
- API documentation with Swagger UI and ReDoc
Tech Stack
- FastAPI: High-performance web framework for building APIs
- SQLAlchemy: SQL toolkit and ORM
- Alembic: Database migration tool
- Pydantic: Data validation and settings management
- SQLite: Lightweight disk-based database
- Uvicorn: ASGI server
Project Structure
.
├── alembic/ # Database migrations
│ └── versions/ # Migration scripts
├── app/ # Application code
│ ├── api/ # API endpoints
│ │ └── endpoints/ # API route handlers
│ ├── core/ # Core functionality
│ ├── db/ # Database
│ │ └── repositories/ # Database repositories
│ ├── models/ # SQLAlchemy models
│ └── schemas/ # Pydantic schemas
├── alembic.ini # Alembic config
├── main.py # Application entry point
└── requirements.txt # Dependencies
Getting Started
Prerequisites
- Python 3.8+
Installation
-
Clone the repository
-
Install the dependencies:
pip install -r requirements.txt
-
Run database migrations:
alembic upgrade head
-
Start the server:
uvicorn main:app --reload
API Documentation
Once the server is running, you can access:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
API Endpoints
GET /api/v1/todos
: List all todosPOST /api/v1/todos
: Create a new todoGET /api/v1/todos/{todo_id}
: Get a specific todoPUT /api/v1/todos/{todo_id}
: Update a specific todoDELETE /api/v1/todos/{todo_id}
: Delete a specific todo