A RESTful Todo API built with FastAPI and SQLite for efficient task management. The API allows users to create, update, search, filter, sort, and manage tasks through clean and well-structured REST endpoints.
- Create new tasks
- Retrieve all tasks
- Retrieve a task by ID
- Update existing tasks
- Mark tasks as completed
- Delete individual tasks
- Delete all completed tasks
- Search tasks by name
- Filter tasks by:
- Priority
- Completion status
- Due date
- Tasks without a due date
- Sort tasks by:
- Task name
- Priority
- Due date
- Completion status
- Request validation using Pydantic
- Proper HTTP status codes and exception handling
- Interactive API documentation with Swagger UI
- Python
- FastAPI
- SQLite
- Pydantic
- Uvicorn
todo/
├── assets/
│ └── swagger.png
├── routes/
│ └── tasks.py
├── database.py
├── schemas.py
├── main.py
├── requirements.txt
├── .gitignore
└── README.md
Clone the repository:
git clone https://github.com/qw3rty-dev/fastapi-todo-api.gitNavigate to the project directory:
cd fastapi-todo-apiCreate a virtual environment:
python -m venv venvActivate the virtual environment.
Windows
venv\Scripts\activateLinux/macOS
source venv/bin/activateInstall dependencies:
pip install -r requirements.txtRun the development server:
uvicorn main:app --reloadOnce the server is running, open:
http://127.0.0.1:8000/docs
to access the interactive Swagger UI.
- CRUD operations
- Dynamic filtering using query parameters
- Dynamic sorting
- Partial updates (PATCH)
- Pydantic request & response models
- Enum-based priority validation
- Parameterized SQL queries
- SQLite database integration
- SQLAlchemy ORM integration
- JWT Authentication
- User authentication & authorization
- Pagination
- Docker support
- Automated testing
- PostgreSQL support
