DevMuhammadFasih/aidd-todo-api
0
AIDD Todo API
Python backend with dual interfaces:
- Phase 1: Console application with Rich UI
- Phase 2: FastAPI RESTful API with Swagger documentation
Prerequisites
- Python 3.13+
- UV package manager
Installation
- Navigate to the backend directory:
cd backend- Install dependencies:
uv syncRunning the Application
Phase 1: Console Application
uv run python -m backend.mainPhase 2: API Server
uv run uvicorn backend.api.main:app --reload --host 0.0.0.0 --port 8000API Documentation: http://localhost:8000/docs (Swagger UI)
API Endpoints (Phase 2)
Example: Create a Task (cURL)
curl -X POST http://localhost:8000/tasks \
-H "Content-Type: application/json" \
-d '{"title": "Buy groceries", "description": "Milk, eggs, bread"}'Response:
{
"id": 1,
"title": "Buy groceries",
"description": "Milk, eggs, bread",
"status": "Pending"
}Console Usage Examples (Phase 1)
See the console application menu for interactive task management with Rich UI.
Development
Running Tests (Optional)
uv run pytestType Checking
uv run mypy srcKeyboard Shortcuts
- Ctrl+C: Exit application immediately
Architecture
Domain Layer (Phase 1)
- models.py: Task dataclass and TaskStatus enum
- services.py: TaskService (business logic)
- ui.py: ConsoleUI (Rich-based interface)
- main.py: Console application entry point
API Layer (Phase 2)
- api/main.py: FastAPI app initialization with CORS
- api/routes.py: RESTful endpoints (GET, POST, PUT, DELETE)
- api/schemas.py: Pydantic v2 request/response models
Storage: In-memory (shared between console and API interfaces)
