The Backend I Deleted
- Role
- Led the product effort. Built the shopper-facing surface, then rebuilt the whole agent front end only.
- Scope
- A shopper-facing agent for BigCommerce storefronts, from hackathon build to alpha and beta.
- Result
- Greenlit, and now hardened for scale by the team it was meant to seed.
TL;DR
- BigCommerce wanted a shopper-facing agent, and agencies queued up to pitch the same recycled chat library with a brand color painted on it, so a counterpart and I used a hackathon to prove we could tailor one to a real store. He built the backend, I built the shopper surface.
- Then I rebuilt it front end only over WebMCP: the tools register on the page, the agent runs in the browser, and about five hundred lines of round-trip protocol got deleted.
- It reads the store through the store's own APIs, finds products semantically, and is graded hard against confident wrong answers.
- The build got us into alpha and beta fast and handed a skeptical org a working reference instead of a diagram: greenlit, and now hardened for scale by the team it was meant to seed.
The demos kept coming. Agencies lined up to sell BigCommerce a shopper-facing agent, one flashy story after another, each the same chat library downloaded from the internet with a brand color painted over it, and the company wanted this and wanted it fast. My team was heads-down on the merchant assistant with nobody to spare, so when the company ran a hackathon, a few days where nobody bugs anybody, a counterpart and I took the window to prove we could do it ourselves and do it better. He took the backend. I took everything the shopper sees. It worked, and oh boy did they like it.
And then I could not let go of one rude question. What does this agent actually do? It searches the catalog, reads stock, adds to the cart, looks up an order, hands you to a human, and every one of those already lives in the shopper's browser, one call away from the page they are already looking at. My counterpart's backend was good work, but it put the agent on the far side of a network, so to touch the store the agent had to stop mid-thought, hand a tool back down to the browser, and ship the entire conversation back up to pick up where it left off. A whole protocol invented for no reason except to cross a boundary and climb back. Was the boundary even necessary? I answered the way I trust most, with a build instead of a document, and I built the whole thing again on my own, front end only, to find out.
The tools were already in the browser
The answer is a young standard called WebMCP, and the idea behind it is almost too simple. A
model's tools are declared right on the page, on a browser object called
document.modelContext, and the agent calls them where they live. No wire, no server
holding the toolbox.
So I took the same shopper UI, kept every stitch of the fit, and moved the agent into the browser next to its tools. Watch what falls away. The resume dance is gone, because the agent never leaves. The second round trip is gone. The schema for serializing product cards over the network is gone, because the card is already a component on the page. Roughly five hundred lines deleted rather than rewritten, and the transport underneath stopped being HTTP and server-sent events and became a plain async generator that the agent and the interface both share. Twenty tools that used to be messages crossing a network became functions the model calls in place.
And living on the page changes how it behaves, not just how it is wired. A BigCommerce storefront is an old PHP multi-page app, so every click tears the page down and rebuilds it, and your lovely conversation goes in the bin with it. Off the rack was cut for a single-page app where nothing is destroyed, so on a real store it forgets you the moment you take its advice. Mine logs the thread as it happens and, when it remounts, puts you back exactly where you were, scroll included, and when something you asked for is about to move the page it warns you first with a short countdown, then re-docks to the side instead of covering the page you asked to see.
Tools on the page, not in my code
Here is the part I am proudest of, and the part that makes this WebMCP and not just a clever
refactor. I did not import my twenty tools and call them from my own code. I registered them on
the page, on that native document.modelContext, the exact object an outside agent
reads. My own bot discovers them there and calls them. And so does anything else that speaks the
standard, Chrome's own experimental agent, Google's tool inspector, whatever comes next. The
store's page stops being a wall an agent has to scrape and becomes something an agent can address
directly, tools and all.
There is a real wrinkle, and solving it is most of the work. A browser extension lives in two
separate JavaScript worlds on the same page. There is the page's own world, where the native
modelContext lives and where an outside agent looks, and there is the isolated world
my extension code runs in, walled off from the page for safety. So I register the tools twice on
purpose. In the page's world I register them natively, so external agents can see them, which is
the whole reason to do this on a storefront at all. In my own isolated world I register a
polyfilled copy, so my bot keeps working even in a browser that has not shipped the native flag
yet. Same tools, two worlds, and the shopper never knows there were two.
The only server I kept
What is left of the backend is almost funny. One thin proxy, a few hundred lines, and its first job is boring on purpose. It holds the API key so the browser never sees it, the one secret you truly cannot ship to a shopper's machine.
Its second job is the interesting one. The proxy owns the system prompt. The instructions that make the agent itself, the ones that took the longest to get right, never ship in the bundle where anyone could copy them, and the proxy strips any system message the browser tries to send, so a hostile page cannot talk over them either. The browser sends only the variable bits, the store's name and voice and a little page context, and the proxy stitches them onto the base prompt on the server side. And because the proxy speaks the plain OpenAI format, the model behind it is a swap, not a rebuild, Gemini today and something else tomorrow, and the browser never notices. It is the one seam I drew deliberately, so the whole thing can grow a real backend later without the front end feeling it.
Reading the store from inside the page
No backend means no comfortable server to fetch data from, so the data has to come from the one place I have, the page itself, on the store's own origin. It turns out that is plenty.
A modern BigCommerce storefront hands the page a read-only catalog token, sitting there as a global variable. My extension code cannot read it directly, because it lives in that other isolated world and page globals do not cross the wall. So I built a small bridge: at the moment a search runs, my code posts a message across to the page's world, the page's world reads the token and posts it back, and the query goes out authenticated. With that token the agent reads the catalog, brands, categories and reviews straight from the store's GraphQL. Ask for your orders and it goes further, riding your own logged-in session cookie to pull your real order history, and it can even sign you in from inside the chat through the store's own login, no second account, so your orders come to life right there in the conversation. And when a store hands over no token at all, the agent drops to a zero-config fallback, scraping the store's own search results and sitemap, so it still works on a store that was never set up for it.
The store that speaks in film titles
Here is my favorite problem in the build, and one the shiny demos never even meet. A storefront search is lexical, it matches words. Ask one of my test stores, a shop that sells nothing but movie posters, for a "poster" and it returns a handful, because the products are called Back to the Future and Coco, not posters. The store knows what it sells, it just does not use your words, and a shopper talks in needs, not SKUs. So the model sits on both ends of the search like bookends. On the way in it breaks the request into an intent, grounds the category and brand names against the store's real vocabulary so "sci-fi" snaps to the store's actual Science Fiction shelf, throws three or four phrasings at the catalog at once, and if the pool comes back thin it loosens the filters one rung at a time until it fills. On the way out it does the one thing a search index never can. It judges: drops the false catches, keeps what fits, ranks the rest, says in a line why. Retrieval is generous, the judgement is the model's, and that is where it stops feeling like a search box and starts feeling like somebody who knows the store.
Here is the part that keeps me honest, though: the LLM is not always the right tool, and a good engineer says so. A store can turn on real semantic search, a proper vector database with embeddings, and for some catalogs it is wonderful, a shop of posters that trade in mood and theme. For others it is worse than plain keyword, a store of technical parts where people search by an exact code and mean it. So the model search is a toggle. Turn it off and the very same query serves the store's own search, keyword or vector, whichever the merchant chose, and you keep whichever one actually helps your catalog.
Teaching it to say I don't know
The failure mode that should keep you up at night is not the one where the agent breaks. It is the one where it is fluent, confident, and wrong. A broken agent tells you it is broken. A lying one sounds exactly like a working one, in the same warm voice, which is what makes it dangerous on somebody's store. So I graded it hard: a sweep of real shopper questions, the true answers worked out from the raw API first, the agent marked like an exam. Seventeen questions, thirteen passed clean, four half passed.
Some misses were spectacular. Asked for the most expensive thing in a catalog that topped out at twelve hundred dollars, it announced the priciest was sixty, because it could not sort by price so it grabbed the word "premium" and guessed. Asked how many products were out of stock, it said two, when the real number was eighty-four, counting the few in front of it and calling it a fact about the whole store. On a store with zero sales it called a product our most popular. And ask it for organic or recycled and it would show you four organic products and swear the store carried no recycled range, not because the recycled ones were missing but because the good organic matches filled a small results pool before the recycled ones could climb in, a false absence manufactured by nothing more than the order I merged results in.
None of them errored. The fix was never more cleverness, it was teaching it the shape of its own ignorance: a real way to sort, a fairer way to merge so every part of a question gets a seat, and small blunt notes riding along with every result, this count is only what you found here, you have no sales data, an empty shelf is not proof the store lacks the thing. Anybody can get an agent to answer. Getting it to know when not to, and say so plainly, is the part nobody claps for and the part that is actually the job.
Watching it without watching the shopper
Here is a problem the shiny demos never have to face, because they never get real users. I wanted evals, the actual questions real shoppers ask and the exact places the agent fumbles, because that is the only honest way to make it better. But a shopping conversation is full of a person, their name, their address, the order they are chasing, and none of that belongs in my logs.
So the serving proxy does the least it can. It takes each turn, drops it raw onto a queue, and answers the shopper immediately, so the scrubbing never sits between a shopper and their reply. A separate worker picks the turn up off that queue, runs it through a de-identification pass that strips names, emails, phone numbers and addresses, and only then writes it to the eval log. The order is the whole point: it logs after the scrub or not at all, so a failure loses a trace rather than leaking a person. I wrote the engineering team a short design note weighing an off-the-shelf de-identification service against having a model do the scrubbing, because this is exactly the kind of decision you want made on purpose and written down, not discovered later in a log.
It vanishes into the store
A guest that clashes with the room is not a guest, it is a stain, so a great deal of the work went into making this thing disappear into whatever store it lands on. It lives inside a shadow DOM, sealed off so the store's CSS cannot leak in and break it and its own cannot leak out and break the store, which on the open web of a thousand hand-built themes is survival, not a nicety. Every color and font is a CSS variable, so a store re-skins the whole assistant with a handful of tokens and even swaps its icons, and every string it renders is editable and translatable, so a French store gets a French assistant. The merchant drives all of it from a settings surface, where I gave them skills to toggle rather than raw tools, because handing a merchant the raw tooling is handing them a way to break their own agent while thinking they are tuning it.
So why build it twice?
Because the second build had a job that had nothing to do with elegance. With no server to stand up, I got it in front of real shoppers fast, into alpha and then beta, with the evals flowing back while the actual product was still being built, and it took the pressure off the engineering team, because the awkward corners were already being explored in something they could open and poke at. A prototype that runs is a far better brief than one that is described. Not everyone believed a browser-native stack could carry a real in-store agent, and I did not want to win that argument with a diagram. I put a working one on a real store and let it make the case.
And the surprise? There wasn't one, and I mean that as the point. Search, cart, order status, grounded answers, a handoff to a human, signing you in for your orders, none of it is exotic, it is the floor a proper shopping agent has to have before it belongs on a store at all, and our industry keeps selling that floor as a destination. Anybody can put a brand color on a downloaded chat agent. Moving the agent to where its tools already were, and asking out loud whether it needed a backend behind it at all, is where the real work was, and for this store the honest answer was no. You learn more from asking that question than from any showcase, which, in my experience, is still where the whole thing is won or lost.
Most useful early on AI products, design systems and design engineering. If that sounds like something you need, say hello at , or find me on LinkedIn.