
- Implemented project structure - Added SQLAlchemy models and database connection - Created Alembic migrations - Implemented CRUD API endpoints - Added health endpoint - Updated README.md generated with BackendIM... (backend.im)
2.2 KiB
2.2 KiB
Todo Application
A simple Todo application built with FastAPI and SQLite.
Features
- Create, read, update, and delete todo items
- SQLite database with SQLAlchemy ORM
- Database migrations with Alembic
- Health check endpoint
- OpenAPI documentation
Project Structure
todoapplication/
├── alembic/ # Database migrations
├── app/ # Application code
│ ├── api/ # API routes and endpoints
│ │ ├── crud/ # CRUD operations
│ │ ├── endpoints/ # API endpoint implementations
│ ├── core/ # Core functionality
│ │ ├── config.py # Application configuration
│ ├── db/ # Database related code
│ │ ├── session.py # Database session management
│ ├── models/ # SQLAlchemy models
│ │ ├── todo.py # Todo model
│ ├── schemas/ # Pydantic schemas
│ │ ├── todo.py # Todo schemas
├── storage/ # Storage directory
│ ├── db/ # Database files location
├── alembic.ini # Alembic configuration
├── main.py # Application entry point
├── requirements.txt # Python dependencies
API Endpoints
GET /api/v1/todos
: Get 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 endpointGET /docs
: API documentation (Swagger UI)GET /redoc
: API documentation (ReDoc)
Getting Started
Prerequisites
- Python 3.8+
Installation
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
- Run the application:
uvicorn main:app --reload
The application will be available at http://localhost:8000.
Database Migrations
Run migrations:
alembic upgrade head
Create a new migration:
alembic revision -m "your migration message"