# M03 Lab — FastAPI Project Scaffold

This scaffold gives you a starting point for the REST API lab. You'll use AI tools to
build from this foundation.

## Project Structure (after completion)

```
m03-api/
├── app.py          # FastAPI application entry point
├── models.py       # Pydantic data models
├── service.py      # Business logic layer
├── requirements.txt # Dependencies
└── test_api.py     # Tests (generated in Step 5)
```

## Starter: app.py

```python
"""Task Management API — Built with AI assistance in M03 Lab."""

from fastapi import FastAPI

app = FastAPI(title="Task Management API", version="0.1.0")


@app.get("/health")
async def health_check():
    """Health check endpoint."""
    return {"status": "ok"}


# TODO: Add your endpoints here using AI assistance
# - POST /tasks — Create a new task
# - GET /tasks — List all tasks
# - GET /tasks/{task_id} — Get a task by ID
```

## Starter: requirements.txt

```
fastapi>=0.100.0
uvicorn[standard]>=0.23.0
pydantic>=2.0.0
pytest>=7.0.0
httpx>=0.24.0
```

## Setup

```bash
# Create project directory
mkdir -p ~/workshop/m03-api
cd ~/workshop/m03-api

# Copy the starter files above, then install deps
# First activate venv: source ~/workshop/venv/bin/activate
pip install -r requirements.txt

# Verify the scaffold runs
uvicorn app:app --reload --port 8000
# Visit http://localhost:8000/health — should return {"status":"ok"}
```

## Next: Use AI tools to build from here

Pick Scenario A (Task Management), B (Book Review), or C (your own idea). Use OpenCode
and VS Code Chat to generate the models, service layer, and endpoints.
