
- Implement Todo CRUD API endpoints - Set up SQLite database with SQLAlchemy - Create Todo model and schemas - Configure Alembic migrations - Add comprehensive documentation 🤖 Generated with and Co-Authored by [BackendIM](https://backend.im)
2.0 KiB
2.0 KiB
Todo Backend Service API
This is a RESTful API for a Todo application built with FastAPI and SQLite. The API allows users to create, read, update, and delete todo items.
Features
- CRUD operations for todo items
- Filtering todos by completion status
- SQLite database with SQLAlchemy ORM
- Alembic migrations
- API documentation with Swagger UI and ReDoc
Project Structure
todobackendservice/
├── alembic/ # Database migrations
├── app/ # Application package
│ ├── api/ # API endpoints
│ ├── core/ # Core functionality, configs
│ ├── db/ # Database session, dependencies
│ ├── models/ # SQLAlchemy models
│ ├── schemas/ # Pydantic schemas
│ └── storage/ # Storage directory for SQLite
├── main.py # Application entry point
├── alembic.ini # Alembic configuration
└── requirements.txt # Project dependencies
Getting Started
Prerequisites
- Python 3.8 or higher
- pip (Python package installer)
Installation
- Clone the repository:
git clone <repository-url>
cd todobackendservice
- Install the dependencies:
pip install -r requirements.txt
- Run the database migrations:
alembic upgrade head
- Start the application:
uvicorn main:app --reload
The API will be available at http://localhost:8000
.
API Documentation
The API documentation is available at:
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc
API Endpoints
Todos
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 todoDELETE /api/v1/todos/{todo_id}
- Delete a todo
Query Parameters
skip
- Number of records to skip (default: 0)limit
- Maximum number of records to return (default: 100)completed
- Filter by completion status (optional)