Simple ToDo List API built with FastAPI and PostgreSQL for educational purposes.
- Create, read, update, delete tasks
- Task status management (pending, completed, etc.)
- Automatic API documentation (Swagger UI at
/docs) - PostgreSQL database persistence
- Install dependencies:
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt-
Ensure PostgreSQL is running (default:
postgresql://genesis_core:genesis_core@localhost:5432/genesis_core) -
Run the application:
uvicorn main:app --reload| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Welcome message |
| GET | /health |
Health check |
| POST | /tasks |
Create a new task |
| GET | /tasks |
List all tasks |
| GET | /tasks/{id} |
Get task by ID |
| PATCH | /tasks/{id} |
Update task |
| DELETE | /tasks/{id} |
Delete task |
# Create a task
curl -X POST http://localhost:8000/tasks \
-H "Content-Type: application/json" \
-d '{"title": "Buy groceries", "description": "Milk, eggs, bread", "status": "pending"}'
# List tasks
curl http://localhost:8000/tasks
# Update task
curl -X PATCH http://localhost:8000/tasks/1 \
-H "Content-Type: application/json" \
-d '{"status": "completed"}'
# Delete task
curl -X DELETE http://localhost:8000/tasks/1Visit http://localhost:8000/docs for Swagger UI.