A small CRUD API for managing tasks with FastAPI and SQLite.
SQLite is a lightweight embedded database that stores data on disk in a single file. It is a good fit for small projects, local development, and simple APIs because it requires no separate server process.
The database lives in the project root as tasks.db. The application creates it automatically when it starts.
pip install -r requirements.txt
uvicorn main:app --reloadThe server starts at http://localhost:8000 and the API docs are available at http://localhost:8000/docs.
- Creates the tasks table if it does not exist
- Inserts three seed tasks only when the table is empty
- Persists task data across restarts
- Supports CRUD operations through the same API endpoints as before
SELECT * FROM tasks;A SQLite viewer such as DB Browser for SQLite can open tasks.db and show the table contents.
todo-api/
├── main.py
├── tasks.db
├── requirements.txt
├── README.md
└── docs/
