AdStack
Internal engineering documentation for AdStack, the chat-driven ad creative system.
AdStack turns an offer URL into finished ad creative: research, copy, images, and video clips. Everything happens through chat. There are no per-feature form pages, no wizard, no dedicated “generate ad hooks” screen. The user talks to a host LLM, the host calls agents and tools, and outputs land in the chat, the media library, or an offer folder.
These docs describe how the system is built and operated. They are written for whoever is changing the code, which is usually one person plus AI agents.
The one-paragraph version
A TanStack Start app runs on Cloudflare Workers. It talks to Railway Postgres through Hyperdrive, stores media in an R2 bucket, and delegates all LLM calls to a second Worker that fronts the Cloudflare AI Gateway. Long-running media work (image generation, video generation, offer scraping) goes onto Cloudflare Queues consumed by a third Worker. Every AI capability is a “module”: a row in the database with a system prompt and a user prompt, mirrored by a markdown file in the repo and registered in lib/registry.ts.
Where to start
Getting started
Install, environment variables, and the commands that matter.
Architecture
The three Workers, the request paths, and the repo layout.
Agents and chat
The agentic loop, the module registry, and how prompts reach runtime.
Media
Image and video generation, characters, elements, and the production pipeline.
Operations
Environments, deploys, CI, and the ground-truth checks.
What is deliberately not here
- Product and UI design rules. Those live in
.claude/project/design-system.mdand.claude/project/projectbrief.md. - Current work in progress. That is
.claude/project/STATUS.md, updated every session. - Task history and changelogs. Those are archives, too large to read whole.