What the gateway is#
@rebilder/gateway connects your existing website to AI agents using content-negotiation middleware. It classifies every request as AI agent, human, search crawler, or protocol client, and serves agents a clean markdown transformation of the canonical page, rendered from your source of truth. Humans and crawlers pass through untouched, as if the gateway weren’t there.
Mumm gateway
One connection.
The right response.
Incoming request → matching format
- Markdown path: an agent asking with
Accept: text/markdown(or an identified agent platform) gets atext/markdownresponse rendered from your service descriptions, feature guides, product data and policies. Important facts come first, under 5KB by default. - Pass-through: humans and search crawlers get
nullfrom the gateway, so your HTML pipeline runs unchanged. Googlebot always receives canonical HTML. - Events: every handled request, including pass-throughs, emits one
RebilderEventV0to youronEventhook: who asked, what they got, how long it took. That feed powers the Mumm for Business console.
In the captured demo, the same product request dropped from 91,226 bytes of PDP HTML to 1,315 bytes of markdown, a 98.6% reduction, with the price moving from character offset 23,185 to line 4. The capture includes the source page and both responses.
Install and verify the gateway#
Connect your business sources and event reporting, then verify serving and reporting separately. The scope depends on your website and the available sources:
- Install
@rebilder/gateway, which has zero external runtime dependencies by policy. Our packages are published on npm under@rebilder, the company behind Mumm. - Wire your source of truth: up to five optional resolver functions from URL to your own data. Three are commerce shaped (
product,policies,catalog). Two are universal:documentfor any other page, such as a guide or a service, andcollectionfor an index of them. Wire only the ones you have. - Mount the adapter for your stack: Next.js middleware, Shopify app proxy, Express/Fastify, a Cloudflare Worker, or the fetch middleware for SvelteKit, Nuxt, Astro, React Router, Hono, Bun, Deno, Netlify and Vercel.
- Connect event reporting with your site-scoped key and the event sink. Use the runtime-specific flush or waitUntil instructions so events reach your Console.
- Verify with curl: same URL, markdown for agents, unchanged HTML for everyone else. Then confirm that the request appears in Console → AI visits.
For WordPress, use the free plugin. For a custom integration, start with Quickstart: Next.js end to end. On another stack? Jump straight to the Shopify, Node, Cloudflare, framework or runtime pages; the config object is identical everywhere.
Built for production stacks#
- Zero external runtime dependencies. The gateway’s only runtime deps are internal workspace packages, and it re-exports their public types, so you install one package. No framework imports anywhere: the core is written against web-standard
Request/Response. - Edge latency budget: p95 < 50ms compute, no network calls on the hot path. Classification is a handful of header string scans (well under 1ms); rendering is pure string assembly. Your source resolvers are the only variable, so back them with in-memory data or a fast cache.
- The gateway passes unmatched requests and source or rendering failures through to your existing application.
- Open source under Apache-2.0. The source, tests and ARS conformance corpus are on GitHub, where issues and pull requests are welcome.
Guarantees#
Key pages#
| Page | What it covers |
|---|---|
| Quickstart | Next.js end to end: install, wiring, a complete catalog example, curl verification. |
| Next.js adapter | proxy.ts / middleware.ts integration, the dedicated markdown route, matcher scope. |
| Shopify adapter | App-proxy setup in Partners, the HMAC security model, response semantics. |
| Node adapter | Express middleware, Fastify via @fastify/middie or an onRequest hook, structural types. |
| Cloudflare & edge | The worker fetch handler, origin pass-through, Vercel Edge and other WinterCG runtimes. |
| Frameworks | The /fetch middleware, with recipes for SvelteKit, Nuxt, Astro, React Router, Remix and Hono. |
| Runtimes | Bun, Deno, Netlify Edge Functions and Vercel Routing Middleware. |
| Sources | The GatewaySources contract: field-by-field types, resolution order, error containment. |
| Classification | How requests are detected: the five checks, the crawler guardrail, confidence semantics. |
| Events | RebilderEventV0 field reference, the wire protocol, the HTTP and console sinks. |
| llms.txt | Generate an llms.txt directory from your source configuration. |
| Troubleshooting | Real failure modes with fixes. |
| API reference | Every public export of @rebilder/gateway and @rebilder/events, with signatures. |
Last updated
