The Docs identity is
docs-app because apps/docs and docs.tuturuuu.com
belong to developer documentation. The apex /docs, /en/docs and /vi/docs
currently serve Web’s Documents entry. Keep that fallback until the gateway
binds the Docs Worker. Keep the existing public-docs family independent.
The regression belongs alongside the Documents entry test in
apps/gateway/src/web-family.test.ts.
Tuturuuu Wiki
Tuturuuu Wiki is a separate workspace knowledge base. Its satellite inapps/wiki (@tuturuuu/wiki) uses the wiki session audience and serves
/wiki on the apex and wiki.tuturuuu.com on its subdomain. Web owns the
Wiki API and public share routes. The Office satellites follow the same
Worker and session patterns. See Tuturuuu Wiki.
Web API authentication
Workspace Wiki, Office and Docs useresolveRequestActor from
apps/web/src/lib/app-session-actor.ts. Keep the route’s allowed audiences,
membership and permissions in the route adapter. Pass the resolver’s sanitized
request to membership and permission helpers for Supabase sessions. For
admin-backed sessions, pass the verified principal and scope any profile reads
to authorized workspace members, or to the caller alone if the route admits
non-members. Only Wiki opts into the platform CLI bearer.
The resolver tests cover credential precedence and audience checks. The Office
and Docs context tests verify the actor used by the route and confirm that
suspension lookup failures stop access before workspace reads.
Scaffold
-
Create the target workspace manifest with its name, private flag and
scripts matching
apps/wiki/package.json. Runbun addin the target workspace for the dependencies used by its editor, its sharedinternal-apiclient and the Start runtime. Commit the resulting rootbun.lockdelta. Copy.gitignore,env.exampleandREADME.mdfromapps/wikiand replace the hosts, profile variable, auth key, workspace paths and validation commands for the new app. Copytsconfig.json,tsconfig.cloudflare.json,vitest.config.mts,src/i18n/request.tsandsrc/i18n/routing.ts. Supply matchingmessages/en.jsonandmessages/vi.jsonkeys and placeholders. Copy the shared shell namespaces insrc/i18n/shell-messages/. Adaptsrc/lib/server-only.test-stub.tsand the test alias if the test uses RSC modules. Register the app inscripts/i18n-namespace-apps.js,scripts/i18n-namespace-policy.jsandscripts/i18n-common.js. The namespace and command-launcher checks load<locale>.<namespace>.jsonand numbered shards fromsrc/i18n/shell-messages/. Keep the runtime message imports in sync with those files. -
Copy
src/constants/common.ts,src/proxy.ts, andsrc/app/[locale]/(auth)/verify-token/page.tsx. Substitute the auth key forwikiin the URL resolver, mounted session and centralized proxy. Copysrc/app/api/auth/{verify-app-token,refresh-app-session}/route.tswith the same key. The shared bridge refuses these writers on an apex mount. Keep the app-scoped account and login return targets consistent. Use explicit static prefixes and filenames in the proxy matcher so dotted workspace or item paths still run auth. Setmounts.proxyAllMountedPaths: trueinstart-bridge.config.tsto run the proxy for every mounted request outside the emitted asset boundary. -
Copy
src/app/[locale]/{layout,page}.tsxfor the shell and default workspace entry. In the entry and authenticated server pages, callawait connection()before resolving the session or reading data. Put the feature pages insrc/app/[locale]/(dashboard)/[wsId]/, keeping app-specific components with their routes and reusable editor components inpackages/ui. Build hrefs relative to the app root. Use locale-aware navigation, and pass the locale andwithAppBasewhere a shared editor builds raw links. -
Adapt
src/lib/wiki-api.tsand the feature’s server page loader. ResolvegetSatelliteAppSessionUser('<key>'), then forward request auth through the first-party internal API client to the profile’s exact Web origin. Reject access before rendering and preserve 404s for missing/unreadable workspaces or items. Keep data and access checks in Web. For Docs use the Web documents APIs. For Slides and Sheets use the Web Office items API and enforce the item kind. Admit the workspace withworkspaceOffice(ws).getContext(kind), which answers 404 for a missing session, non-member, disabled flag or other kind. Web’s Office API scopes aslidesorsheetsapp session to its own kind. The editors, presenter and labels are shared from@tuturuuu/ui/office/*. Keep existing share permissions and revision checks. Local endpoints are reserved for app auth and build information. -
Copy
cloudflare/profile.ts,start-bridge.config.tsandstart-bridge.routes.json, substituting the key, host, Web origin and apex base from the table. Staging serves the reserved<key>.tutur3u.comhost. Production serves the two canonical mounts. Generate the app’s bridge wiring and fill in the same profile selection as Wiki invite.config.mtsandvoid.config.ts.Retain the generatedcloudflare/worker.ts,src/start-bridge/*,src/{router.tsx,start.ts,routeTree.gen.ts}andsrc/routes/*. Copysrc/app/api/build-info/route.tsand the app-specificcloudflare/auth-redirect.runtime.mjsfixture before running the codemod. The codemod loadsstart-bridge.config.tswith Node type stripping (Node 22.18 or later) and refuses to overwrite a hand-written runtime file, so run it before copying Wiki’s files. Its workflow and artifact script cover only staging; copy Wiki’sproductionartifact job and profile-aware Worker name. Substitute Wiki’scloudflare/emitted-worker.fixture.mjsandcloudflare/native-built-worker.runtime.mjsfor the codemod’s runtime launcher. Use the same pinned Miniflare dependency as Wiki. Exercise the emitted JavaScript in Workerd with the profile’s hosts, local asset bytes, disposable auth bindings and a closed outbound boundary. Keep theRUNTIME_HEADERmarker in the app-owned response policy so the acceptance check can identify the native Worker. Use Start’s document adapter and bound any nested item catch-all to its feature path. A catch-all under the workspace root can capture API requests in a Next satellite.
Registers and legacy routes
-
Add the key and mount to
packages/utils/src/app-mounts.ts. Use'docs-app': '/docs'for Docs. Register the app origins inpackages/utils/src/internal-domain-entries.tsand its local origin inpackages/utils/src/portless.ts. Updatescripts/check-internal-app-auth.jsfor the directory, target, proxy and URL constants. Add the key toapps/web/src/legacy-api-routes/v1/users/me/session-auth.tsand toALL_SATELLITE_APP_SESSION_TARGETSinapps/web/src/lib/api-auth-audiences.tsfor shared shell endpoints. For the people picker, add the key toallowAppSessionAuth.targetAppinapps/web/src/app/api/v1/workspaces/[wsId]/people/route.ts. Allow the key explicitly on the owning Web endpoints and keep their membership, permissions and user-suspension checks. Extend the latest definition ofprivate.cross_app_internal_app_names()in an additive SQL migration with an exact rollback. Use the Wiki migration20261130001501_wiki_cross_app_token_audience.sqlas the shape. Preserve grants and existing audiences, and coordinate the version and target list with the other satellite owners. The app’s auth key must be present before its subdomain handoff is enabled. -
Add or replace the app entry in
packages/utils/src/launchable-apps.tsand its icon inpackages/satellite/src/components/apps-launcher-icons.ts. Wire workspace feature and permissions inapps/web/src/lib/workspace-app-access.tsand the Web/api/v1/workspaces/[wsId]/app-accessroute. Use Web’s[wsId]/navigation.tsxand[wsId]/sidebar-apps.tsfor links and aliases, andpackages/ui/src/components/ui/custom/sidebar-categories.tsfor the Office category. Keep the existingdocumentssidebar preference ID for Docs. Add the new slug tocommand_launcher.app_namesandcommand_launcher.app_descriptionsin every EN and VI bundle that ships the launcher, including the Office shell shards, and runbun i18n:sort. Append the app after existing launcher entries so their navigation order stays stable. Add its preview mission topackages/utils/src/onboarding.tsand its local origin to the assertions inpackages/utils/src/__tests__/app-url.test.ts. Add the active-mount and fallback URL cases inpackages/utils/src/launchable-apps.test.ts. -
Register the new directory in
packages/utils/src/commercial-comparison.tsand supply itscommercialComparison.appsandcommercialComparison.featureslabels inapps/web/messages/{en,vi}.jsonandapps/marketing/messages/{en,vi}.json. Match the row’s availability to the app’s release state. -
Extend
apps/web/src/lib/office-legacy-redirect.tswith the app’s legacy path and an active-mount check. Map/{wsId}/documents/**to/docs/{wsId}/**,/{wsId}/office/slides/**to/slides/{wsId}/**and/{wsId}/office/sheets/**to/sheets/{wsId}/**. Keep the tail, encoded query and app-first explicit locale. Scope compatibility redirects to GET and HEAD. Invoke the redirect fromapps/web/src/lib/public-page-proxy.tsafter any public-share exceptions. Cover the legacy URL and query inapps/web/src/lib/office-legacy-redirect.test.ts. The existing Web UI is the rollback target before admission. Retire the duplicate workspace UI after the cutover has stabilized, keeping compatibility route shapes and redirects. -
Extend the gateway’s locale-root aliases in
apps/gateway/src/worker.tsandapps/gateway/src/office-mount.test.ts. Use distinct exact path exclusions inapps/gateway/src/mount-web-paths.tsfor any Web-owned public share paths. Use the gateway’s sharedmatchMountWebPathcheck after mount admission. Test that canonical share URLs stay on Web and that ambiguous spellings fail before dispatch, including repeated slashes, malformed escapes, encoded share-path letters or separators, case variants and dot-segments. Reserve the product’s mount and public path segments inpackages/utils/src/workspace-handle.tsand its tests. Where a public path overlaps a historical workspace handle, keep an explicit app-first locale in compatibility redirects, navigation and launcher URLs. A mount is active only when the gateway has both its exact/nested paths and binding. -
Regenerate the app bridge registries and the repo’s route and documentation
inventories. Add each app’s exact subdomain build-info endpoint to
PROBED_APPSinpackages/roadmap-core/src/live/host-probe.tsso the roadmap reports observed deployment status. Updateapps/docs/platform/features/docs-markdown.mdxfor Docs andapps/docs/platform/features/office-editors.mdxfor Slides and Sheets with the new routes, compatibility ownership and links to the route, permission and share tests. Updateapps/docs/platform/architecture/satellite-apps.mdxand add any new docs page toapps/docs/docs.json.
CI and release
- Adapt
.github/workflows/wiki-cloudflare.yamlto.github/workflows/<key>-cloudflare.yaml. The reusable workflow is.github/workflows/native-start-app.yaml. Keep its affected check,ready-for-cigating, exact-source build metadata, dry run, hash/seal, emitted-Worker tests and restore tests. Copyscripts/ci/wiki-native-artifact.pytoscripts/ci/<key>-native-artifact.pyand substitute the Worker names, receipt name and source SHA env. Wire the workflow in thecimap and theheldrecord intuturuuu.ci.ts. Register the protected frontend and policy regression inscripts/ci/production-publication-policy.tsandscripts/ci/production-publication-policy.test.js. Copy Wiki’s planner sparse-checkout paths and reusable-workflow permissions. Register the PR gate and trigger digest inscripts/ci/pr-label-gate.jsandscripts/ci/pr-label-gate.test.js. Updatescripts/ci/ci-plan-catalog.jsonfromcloudflareOwnershipinscripts/ci/ci-plan.mjs, the run-decision inventory inscripts/ci/fixtures/workflow-run-decisions.json, and the production-profile build-identity list inscripts/ci/native-runtime-prerequisites.test.js. - Record the held app in
productionPublicationExemptionsintuturuuu.ci.tsand as aheldentry inscripts/ci/production-fleet.mjs. Add a private entry topackages/utils/src/seo-policy.json, runnode scripts/generate-app-seo.js, and mirror the policy incloudflare/worker.ts. List the generatedrobots.txtin the public assets registry and in the artifact script’sPUBLIC_FILES. Keep anext.config.tswithseoAppand usegenerateCommonMetadatain the locale layout. Ship the sharednot-found.tsx,error.tsxandglobal-error.tsxstatus pages and asrc/proxy.test.tsthat loads the proxy. These registries run inturbo-unit-tests.yamlanddocs-seo-check.yaml, not incheck:changed. - Use
VITE_DOCS_APP_NATIVE_PROFILE,VITE_SLIDES_NATIVE_PROFILEandVITE_SHEETS_NATIVE_PROFILErespectively, withstagingandproductionvalues. UseDOCS_APP_SOURCE_SHA,SLIDES_SOURCE_SHAandSHEETS_SOURCE_SHAfor artifact sealing. For a base-bound build useTUTURUUU_BASE_PATHwith the table’s apex path. An emitted artifact used on both hosts derives its base per request. - Build runtime configuration from
NEXT_PUBLIC_APP_URL,NEXT_PUBLIC_WEB_APP_URL,NEXT_PUBLIC_SUPABASE_URLandNEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY. CI reads the publicSTAGING_SUPABASE_URL,STAGING_SUPABASE_PUBLISHABLE_KEY,PRODUCTION_SUPABASE_URLandPRODUCTION_SUPABASE_PUBLISHABLE_KEYvariables. Register stage callback origins inNEXT_PUBLIC_TUTURUUU_INTERNAL_APP_DOMAINSon staging Web. ProvisionTUTURUUU_APP_COORDINATION_SECRETwith the matching Web stage value for handoff verification. The shared auth boundary uses Supabase configuration for session and MFA verification. ProvisionSUPABASE_SECRET_KEYfor the shared auth authority with the same custody and review as the other mounted satellites. The Office feature adapters receive Web API data and never need a DB binding or an R2 binding to render it. The release publisher uses the environment’sCLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_ID. - Run
node scripts/check-internal-app-auth.js, the app’sroutes:check,type-check,testand the exact-headttr resources run -- bun check:changedgate. Require redirect tests for both locales, membership denial before data rendering, share entry/reader parity, full callback return URL preservation, and mounted cookie isolation. Include dotted workspace paths at the subdomain and apex mount in the emitted auth tests. In staging, check authenticated editor flows in both locales, MFA, logout, denied workspaces and the expectedx-tuturuuu-runtimeheader. - Cutover needs release-authority approval for staging providers, domains,
DNS, routes and the explicit per-app publication decision. Capture the
current gateway version, routes, content and rollback routing first.
The cutover uses
apps/gateway/wrangler.jsoncto add the exact and nested paths toGATEWAY_MOUNTED_PATHSand bindMOUNT_DOCS,MOUNT_SLIDESorMOUNT_SHEETSto its Worker. DeriveNEXT_PUBLIC_TUTURUUU_ACTIVE_APP_MOUNTSusingscripts/active-app-mounts.mjsafter the binding passes acceptance. Add each base toPENDING_WEB_MOUNTSif Web and the gateway publish in different steps, then remove it after signed-in acceptance. Verify the live list with--live <version.json>. Follow the native Start runbook for artifact acceptance, activation and rollback.