Audience
A client SaaS platform or internal tool for automated, on-brand content and visual marketing assets.
Role
Sole developer.
Tech stack
- Language: Python 3.12
- API: FastAPI
- Data: SQLAlchemy 2.0 + Alembic, PostgreSQL (with JSONB)
- Schema & config: Pydantic v2
- Imaging: Pillow
- Model providers: Anthropic Claude SDK and OpenAI SDK
Architecture highlights
Inward-pointing dependencies
A pure core domain model with zero I/O. Infrastructure (LLM, image, embedding adapters) sits behind structural Python
Protocol interfaces. Vendor SDKs are lazily imported so CI never loads heavy dependencies.Human-in-the-loop activation gate
Ingestion produces a
draft kit. Edits never mutate in place — they create a new snapshot. A review gate requires manual activation before downstream services can use a kit.Budget-aware cost ledger
Granular cost persistence sums and enforces brand-level and generation-level spend caps before invoking expensive AI endpoints.
Exactly one active version
A partial unique index guarantees a single active Brand Kit per brand at the database level.
Key primitives
Pillow
Pillow
Drives deterministic logo and type compositing over generated layouts, ensuring exact brand palette and trademark integrity.
SQLAlchemy & JSONB
SQLAlchemy & JSONB
Stores high-dimensional embeddings as plain JSONB float arrays and computes cosine similarity natively in Python — no local
pgvector dependency.Pydantic v2
Pydantic v2
The central data contract. Structured schemas for LLM extraction and generation outputs are derived directly from Pydantic field definitions and docstrings.
Local commands
The project is driven byjust:
Read the architecture deep dive
The versioned Brand Kit lifecycle, deterministic Pillow compositing, the critique-and-repair loop, and local vector indexing without pgvector.