# How I Build Production AI Apps on Cloudflare with Claude Code

> Source: <https://dev.to/truvisory/how-i-build-production-ai-apps-on-cloudflare-with-claude-code-2hka>
> Published: 2026-06-17 00:03:39+00:00

AI makes it trivial to generate a working demo. Making something that survives real traffic is a different skill. Here's how I approach it — the principles from a talk I gave recently, with the full video at the end.

Start simple — and earn the complexity

Gall's Law: a complex system that works invariably evolved from a simple system that worked. AI tools make it tempting to scaffold a sprawling architecture on day one. Resist it. Ship the simplest thing that solves the problem, then let real constraints pull you toward complexity — not the other way around.

Treat the model like an engineering team you manage

Working well with Claude Code is less about clever prompts and more about setup. The pieces that actually move the needle:

CLAUDE.md — standing context and conventions for the project

Skills (SKILL.md) — reusable folders of know-how, not one-off prompts

MCP servers — give the model real tools and data instead of guesses

Subagents and plan mode — break work down, and review the plan before any code gets written

You're the CTO of a small team. Prompt engineering isn't planning.

Build at the edge

My default stack, and the reasoning behind each piece:

Workers — stateless compute and routing, running close to the user

Durable Objects — one per stateful entity (a chat room, a document), each with its own SQLite for strongly-consistent state

D1 — relational, cross-entity queries: the things a single Durable

Object shouldn't own

KV — read-heavy config and cache

The distinction that matters: a Durable Object owns one entity's state; D1 owns the relationships across entities. Get that boundary right and most of the architecture falls into place.

Don't skip the fundamentals

AI will happily write code that works in the demo and falls over in production. The details you have to enforce yourself:

Idempotency on anything that mutates

Kill N+1 queries; index what you actually query

Observability from day one — at the edge, slow is expensive

Semantic HTML and accessibility on the front end

The throughline

Stay aware of everything you build. "Vibe coding" skips the awareness; intentional coding keeps it. AI is leverage on top of judgment — not a replacement for it.

Full talk (~59 minutes, chapters in the description):
