Building an AI product usually means stitching together a lot of services: a database here, a vector store there, a queue from another provider, a separate place to run the model and something to hold state between requests. Each one works, but every seam is another bill, another set of credentials and another thing that can fail at two in the morning.
For several products now I have built the whole thing on Cloudflare Workers instead. Not because it is fashionable, but because the pieces fit together in a way that removes most of those seams. Here is how they fit, and where each one earns its place.
Workers: the front door and the glue
Workers run your code close to the user without a server to manage. For an AI product they are the API, the webhook receiver, the MCP endpoint and the glue between everything else. I usually put Hono on top for routing, because it is small, fast and does not assume a traditional server.
The important habit is to keep request handlers thin. A Worker should accept the request, check who is asking, and either answer quickly or hand the heavy work to something better suited to it. That keeps the product responsive, even when the model behind it is slow.
D1, Vectorize and Workers AI: what is true and what is similar
D1 is Cloudflare's SQL database. In an AI product it holds the things that must be exact: users, accounts, permissions, and the actual content the product is about. It is where you look when you need to know what is true, not what is similar.
It is tempting to treat the vector store as the database in AI products. I keep them separate. The record lives in D1. The vector index points back to it. If the two ever disagree, D1 wins, and you can always rebuild the index from it.
Vectorize is a vector database, which lets you search by meaning rather than exact words. Workers AI can generate the embeddings that make that possible, without sending data to another provider. Together they cover semantic search, related items and retrieval for a model that needs the right context before it answers.
Embedding is slow compared with a normal request, so it should not happen while a user waits. New content goes into a Queue, and a background consumer embeds it and writes it to Vectorize. The user gets an instant response, and search catches up a moment later.
The rule I follow: D1 holds what is true, Vectorize holds what is similar, and Queues make sure the slow work never blocks the fast work.
Durable Objects: state that stays consistent
Durable Objects are the piece people understand least and the one I value most. Each object is a single, addressable instance with its own storage, and only one copy runs at a time. That makes it a natural home for anything that needs a single, consistent view: a shared document, a conversation, a list that several agents write to at once.
Without it, concurrent writes from agents and people become a locking problem you have to solve yourself. With it, every write to that thing goes through one place, in order, and live updates to connected users come almost for free.
How it comes together in SuperTrove
SuperTrove, the open-source knowledge layer for AI agents I architected, runs entirely on this stack. Agents connect through an OAuth-protected MCP endpoint on Workers. Each list is its own Durable Object, so agents and people can write at the same time without conflicts. Items are stored in D1, and a background queue embeds new ones with Workers AI and indexes them in Vectorize, so the team can search by meaning. It is live at supertrove.ai and open source under MIT, with a one-click deploy for teams who want their own instance.
The same foundations show up elsewhere in my work. StoreAlert uses a Worker and a Queue so a busy sale never drops a webhook. My open-source Shopify on Cloudflare starter wires D1, KV and R2 in from the first commit, so data, sessions and files are ready before any product logic is written.
Where it is not the right fit
One stack is not always the answer. If your product depends on a specific database feature, an existing data warehouse or a team that already runs everything elsewhere, forcing it onto Cloudflare can cost more than it saves. The benefit is fewer seams, and that only matters if the seams were a real problem.
If you are planning an AI product and weighing up where to build it, I am happy to walk through how your pieces would map onto this stack, including the parts that might be better left where they are.