# Style Atlas Catalog Service — SQLAlchemy + httpx Registry for Styles & Sound Effects

## PURPOSE
A persistent backend service for the video's two shared resources: the **86 code-drawn styles** and the **JavaScript sound-effect database** the creator had Claude generate. It stores styles (name, complexity, category, reference JS, prompt template), stores sound effects (id, tag, waveform description), and exposes an httpx-backed client that calls a text-to-speech provider (the video uses Gemini 3.8 Flash TTS, and mentions ElevenLabs) to create the voiceover and fetch a transcript.

## WHY THIS MATTERS
The transcript's through-line is reproducibility: styles ship as prompts that embed real code, and a separate sound-effect library keeps audio consistent across videos. A relational catalog with a service layer is the production way to keep that knowledge durable instead of living in a giant pasted prompt or a description link. The httpx client demonstrates the integration edge where TTS and transcription tooling plug in.

## HOW TO BUILD
Define SQLAlchemy models and a session, then a small client. Key snippet:

```python
class Style(Base):
    __tablename__ = "styles"
    id: Mapped[int] = mapped_column(primary_key=True)
    name: Mapped[str] = mapped_column(String(80), unique=True)
    complexity: Mapped[str] = mapped_column(String(20))   # simple/medium/unique
    reference_js: Mapped[str] = mapped_column(Text)
    effects: Mapped[list["SoundEffect"]] = relationship(back_populates="style")

async def synthesize(voice: str, script: str) -> bytes:
    async with httpx.AsyncClient(timeout=30) as c:
        r = await c.post(TTS_URL, json={"voice": voice, "text": script})
        r.raise_for_status()
        return r.content
```

Seed from the atlas, upsert sound effects, and return a prompt assembled from stored fields. Store word-level SRT returned by the provider alongside each style's render.

## WHEN TO USE IN PRODUCTION
Use it as a shared catalog microservice behind the web app, CLI, and dashboard so all three read one source of truth, and to centralise TTS/transcription calls (with retries and rate limits). Do **not** use it for real-time rendering or when a single JSON file suffices for a solo creator — the DB+service is overhead until multiple tools share it.

## HOW IT HELPS STUDENTS
Teaches ORM modelling, relationships, sessions, async HTTP with error handling, and provider integration — the backbone skills for any AI service.

## STARTER CODE
`starter/main.py` defines the models, an in-memory SQLite session, seed data, and an async httpx TTS stub with TODO markers.
