The Cloudflare AI stack I would use again

Audio version

2:19

Listen while you read

For many AI-enabled products, I keep coming back to a lean Cloudflare-native stack: Workers, Hono, D1, R2, Queues, AI Gateway, and a React or Astro frontend.

It is not the right answer for every system, but it is a strong default for small teams that need speed, low idle cost, and operational simplicity.

Workers and Hono for the API

Workers are a good fit for request-scoped APIs. Hono keeps routing small and readable, which matters when one app serves dashboard routes, public endpoints, and webhooks.

This combination is especially useful for MVPs and internal tools where the API surface changes quickly.

D1 for relational state

D1 fits product metadata:

  • users
  • workspaces
  • runs
  • settings
  • audit rows
  • usage counters
  • content references

Keeping the source of truth relational makes the system easier to inspect and migrate.

R2 for artifacts

AI products often create or depend on files: uploads, generated outputs, map bundles, exports, and logs. R2 is the better place for those artifacts.

Do not force large blobs into the relational database.

Queues for long work

Model calls, ingestion, indexing, and agent runs can be slow or bursty. Queues let the system process work without keeping a server alive.

This is one reason the stack works well for AI workflows.

AI Gateway for control

AI Gateway gives a central place for model routing, caching, retries, and spend visibility. That matters when a product moves from demo to production.

  • Edge Form

    A self-hostable Cloudflare Workers contact form backend with D1 persistence, spam checks, delivery adapters, and CSV export.

  • Flare Control

    A Cloudflare-native platform for orchestrating AI agents with human-in-the-loop controls.

  • Gorgi - Site Widget Assistant

    A one-line-to-embed AI support widget that answers from a website's own content.

Need help with something like this?

Send the product goal, timeline, and current blockers. I’ll help you find the smallest useful next step.

Start a conversation

All posts