1.9 KiB
1.9 KiB
Simple Todo App
A simple todo application built with FastAPI and SQLite.
Features
- Create, read, update, and delete todo items
- Filter todos by completion status
- Health check endpoint
- Database migrations with Alembic
- CORS enabled for all origins
Project Structure
.
├── alembic.ini
├── app
│ ├── api
│ │ ├── health.py
│ │ └── todos.py
│ ├── database
│ │ └── config.py
│ ├── models
│ │ └── todo.py
│ └── schemas
│ └── todo.py
├── main.py
├── migrations
│ ├── env.py
│ ├── script.py.mako
│ └── versions
│ └── initial_migration.py
├── pyproject.toml
├── README.md
└── requirements.txt
Getting Started
Prerequisites
- Python 3.8 or higher
Installation
- Clone the repository:
git clone <repository-url>
cd simpletodoapp
- Install dependencies:
pip install -r requirements.txt
- Run database migrations:
alembic upgrade head
- Start the application:
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
The API will be available at http://localhost:8000
API Documentation
Once the application is running, you can access the API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
API Endpoints
Todo Endpoints
GET /api/v1/todos
- Get all todos (with optional filtering)POST /api/v1/todos
- Create a new todoGET /api/v1/todos/{todo_id}
- Get a specific todoPATCH /api/v1/todos/{todo_id}
- Update a todoDELETE /api/v1/todos/{todo_id}
- Delete a todo
Health Endpoint
GET /health
- Check application health
Environment Variables
The application uses the following environment variables:
- None required for basic setup (SQLite database is stored in
/app/storage/db/db.sqlite
)
License
MIT