Skip to content
Auto
English

On your site

Editors open the studio on your site’s own address, yoursite.com/studio. Your site hands /studio to the CMS Worker over a service binding, a direct connection between two Workers in the same Cloudflare account. The studio, the content and sign-in stay on the CMS Worker; the browser only sees your site.

mountStudio from @tapedb/cms/site takes a request and returns the CMS Worker’s response, or null for anything that isn’t the studio’s. It runs in any site on Cloudflare Workers: a Worker of its own, or a framework on Workers, such as Astro, Next.js, SvelteKit, Nuxt or React Router, where it goes first in middleware.

Bind the CMS Worker in the site’s wrangler config. service is the CMS Worker’s name:

// wrangler.jsonc of the site
{
"name": "harbour-journal",
"main": "worker.ts",
"compatibility_date": "2026-11-26",
"services": [{ "binding": "CMS", "service": "harbour-journal-cms" }]
}

Then let mountStudio answer first:

// worker.ts of the site
import { mountStudio } from "@tapedb/cms/site";
let studio: ReturnType<typeof mountStudio> | undefined;
export default {
async fetch(request: Request, env: { CMS: Fetcher }) {
studio ??= mountStudio({ worker: env.CMS });
return (await studio(request)) ?? site(request, env);
},
};

The site needs @tapedb/cms as a dependency for this one import. npm i @tapedb/cms adds it.

Option Default For
worker the service binding to the CMS Worker
path /studio where the site serves the studio
studioPath /cms the studio’s path on the CMS Worker, studio.path in cms()
auth true forward TapeDB’s sign-in routes

The site forwards these paths and keeps every other:

Path For
/studio, /studio/… the studio, its assets and preview links
/engine/…, /_tapedb/… TapeDB: reads, writes, live editing, claims and members
/auth, /api/auth/… TapeDB’s built-in sign-in

When the site has its own sign-in and the studio uses it (signIn: { tokenPath }, see Sign-in), pass auth: false and the site keeps /auth and /api/auth/ for itself.

Several studios work the same way. With the CMS Worker serving /cms and a branded /newsroom, the site mounts both:

const studios = [
mountStudio({ worker: env.CMS }),
mountStudio({ worker: env.CMS, path: "/newsroom", studioPath: "/newsroom" }),
];
for (const studio of studios) {
const response = await studio(request);
if (response) return response;
}

The CMS Worker gets each request with your site’s address, so everything the studio makes is on your site:

  • the studio’s pages and assets, under /studio/
  • sign-in: the /auth page, the links in sign-in emails and the session cookie
  • preview links, yoursite.com/studio/share?t=…
  • live editing: the WebSocket goes through the binding

The CMS Worker still serves the studio at its own address too, /cms, along with the delivery routes your site reads content from.

Run the CMS app with tapedb dev and the site with wrangler dev, each in its own terminal. Bindings between local sessions connect by Worker name, and wrangler dev lists the binding as local [connected]. The studio is then at the site’s own port, for example http://localhost:8795/studio.

Deploy the CMS app first (tapedb deploy), then the site. A service binding connects Workers in the same Cloudflare account.