
- Set up project structure with FastAPI - Create Todo database model with SQLAlchemy - Add Alembic migrations - Implement CRUD API endpoints for todos - Add health endpoint for application monitoring - Add README with documentation generated with BackendIM... (backend.im)
1.6 KiB
1.6 KiB
Todo Application API
This is a RESTful API for managing todo items built with FastAPI and SQLite.
Features
- Create, read, update, and delete todo items
- SQLAlchemy ORM for database interactions
- Alembic migrations for database versioning
- Health endpoint for monitoring
- API documentation with Swagger UI and ReDoc
Project Structure
todo-application/
├── app/
│ ├── api/ # API endpoints
│ │ └── v1/ # API version 1
│ ├── core/ # Core configuration
│ ├── db/ # Database setup and sessions
│ ├── models/ # SQLAlchemy models
│ └── schemas/ # Pydantic schemas
├── migrations/ # Alembic migrations
├── alembic.ini # Alembic configuration
├── main.py # Application entry point
└── requirements.txt # Dependencies
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 todoGET /health
: Health check endpoint
Documentation
API documentation is available at:
- Swagger UI:
/docs
- ReDoc:
/redoc
Running the Application
uvicorn main:app --reload
The application will be available at http://localhost:8000.
Development
Requirements
- Python 3.8+
- FastAPI
- SQLAlchemy
- Alembic
- Uvicorn
- Ruff (for linting)