Simple Todo App
A simple Todo application built with FastAPI and SQLite.
Features
- Create, read, update, and delete todo items
- RESTful API with JSON responses
- SQLite database with SQLAlchemy ORM
- Alembic for database migrations
- API documentation with Swagger UI and ReDoc
Project Structure
.
├── alembic.ini
├── app
│ ├── api
│ │ ├── endpoints
│ │ │ ├── health.py
│ │ │ └── todos.py
│ │ └── router.py
│ ├── core
│ │ └── config.py
│ ├── database
│ │ ├── base.py
│ │ └── deps.py
│ ├── models
│ │ └── todo.py
│ ├── schemas
│ │ └── todo.py
│ └── services
│ └── todo_service.py
├── main.py
├── migrations
│ ├── env.py
│ ├── README
│ ├── script.py.mako
│ └── versions
│ └── 001_create_todos_table.py
└── requirements.txt
Installation
- Clone the repository:
git clone <repository-url>
cd simpletodoapp
- Create a virtual environment and install dependencies:
python -m venv venv
source venv/bin/activate # On Windows, use `venv\\Scripts\\activate`
pip install -r requirements.txt
- Run the application:
uvicorn main:app --reload
The application will be available at http://localhost:8000.
API Documentation
API documentation is available at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
API Endpoints
Health Check
GET /health
- Check API health status
Todos
GET /api/v1/todos
- Get all todos (with pagination)POST /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
Database Migrations
The application uses Alembic for database migrations:
- Run migrations:
alembic upgrade head
- Create a new migration:
alembic revision -m "your migration message"
License
MIT
Description
Languages
Python
95.6%
Mako
4.4%