Skip to main content
The Office suite includes Docs, Slides and Sheets. Each application serves a locale and workspace after its app mount. Its Worker owns the workspace UI, app session and build identity. Web owns the workspace APIs. 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 in apps/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 use resolveRequestActor 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

  1. Create the target workspace manifest with its name, private flag and scripts matching apps/wiki/package.json. Run bun add in the target workspace for the dependencies used by its editor, its shared internal-api client and the Start runtime. Commit the resulting root bun.lock delta. Copy .gitignore, env.example and README.md from apps/wiki and replace the hosts, profile variable, auth key, workspace paths and validation commands for the new app. Copy tsconfig.json, tsconfig.cloudflare.json, vitest.config.mts, src/i18n/request.ts and src/i18n/routing.ts. Supply matching messages/en.json and messages/vi.json keys and placeholders. Copy the shared shell namespaces in src/i18n/shell-messages/. Adapt src/lib/server-only.test-stub.ts and the test alias if the test uses RSC modules. Register the app in scripts/i18n-namespace-apps.js, scripts/i18n-namespace-policy.js and scripts/i18n-common.js. The namespace and command-launcher checks load <locale>.<namespace>.json and numbered shards from src/i18n/shell-messages/. Keep the runtime message imports in sync with those files.
  2. Copy src/constants/common.ts, src/proxy.ts, and src/app/[locale]/(auth)/verify-token/page.tsx. Substitute the auth key for wiki in the URL resolver, mounted session and centralized proxy. Copy src/app/api/auth/{verify-app-token,refresh-app-session}/route.ts with 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. Set mounts.proxyAllMountedPaths: true in start-bridge.config.ts to run the proxy for every mounted request outside the emitted asset boundary.
  3. Copy src/app/[locale]/{layout,page}.tsx for the shell and default workspace entry. In the entry and authenticated server pages, call await connection() before resolving the session or reading data. Put the feature pages in src/app/[locale]/(dashboard)/[wsId]/, keeping app-specific components with their routes and reusable editor components in packages/ui. Build hrefs relative to the app root. Use locale-aware navigation, and pass the locale and withAppBase where a shared editor builds raw links.
  4. Adapt src/lib/wiki-api.ts and the feature’s server page loader. Resolve getSatelliteAppSessionUser('<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 with workspaceOffice(ws).getContext(kind), which answers 404 for a missing session, non-member, disabled flag or other kind. Web’s Office API scopes a slides or sheets app 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.
  5. Copy cloudflare/profile.ts, start-bridge.config.ts and start-bridge.routes.json, substituting the key, host, Web origin and apex base from the table. Staging serves the reserved <key>.tutur3u.com host. Production serves the two canonical mounts. Generate the app’s bridge wiring and fill in the same profile selection as Wiki in vite.config.mts and void.config.ts.
    Retain the generated cloudflare/worker.ts, src/start-bridge/*, src/{router.tsx,start.ts,routeTree.gen.ts} and src/routes/*. Copy src/app/api/build-info/route.ts and the app-specific cloudflare/auth-redirect.runtime.mjs fixture before running the codemod. The codemod loads start-bridge.config.ts with 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’s production artifact job and profile-aware Worker name. Substitute Wiki’s cloudflare/emitted-worker.fixture.mjs and cloudflare/native-built-worker.runtime.mjs for 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 the RUNTIME_HEADER marker 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 in packages/utils/src/internal-domain-entries.ts and its local origin in packages/utils/src/portless.ts. Update scripts/check-internal-app-auth.js for the directory, target, proxy and URL constants. Add the key to apps/web/src/legacy-api-routes/v1/users/me/session-auth.ts and to ALL_SATELLITE_APP_SESSION_TARGETS in apps/web/src/lib/api-auth-audiences.ts for shared shell endpoints. For the people picker, add the key to allowAppSessionAuth.targetApp in apps/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 of private.cross_app_internal_app_names() in an additive SQL migration with an exact rollback. Use the Wiki migration 20261130001501_wiki_cross_app_token_audience.sql as 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.ts and its icon in packages/satellite/src/components/apps-launcher-icons.ts. Wire workspace feature and permissions in apps/web/src/lib/workspace-app-access.ts and the Web /api/v1/workspaces/[wsId]/app-access route. Use Web’s [wsId]/navigation.tsx and [wsId]/sidebar-apps.ts for links and aliases, and packages/ui/src/components/ui/custom/sidebar-categories.ts for the Office category. Keep the existing documents sidebar preference ID for Docs. Add the new slug to command_launcher.app_names and command_launcher.app_descriptions in every EN and VI bundle that ships the launcher, including the Office shell shards, and run bun i18n:sort. Append the app after existing launcher entries so their navigation order stays stable. Add its preview mission to packages/utils/src/onboarding.ts and its local origin to the assertions in packages/utils/src/__tests__/app-url.test.ts. Add the active-mount and fallback URL cases in packages/utils/src/launchable-apps.test.ts.
  • Register the new directory in packages/utils/src/commercial-comparison.ts and supply its commercialComparison.apps and commercialComparison.features labels in apps/web/messages/{en,vi}.json and apps/marketing/messages/{en,vi}.json. Match the row’s availability to the app’s release state.
  • Extend apps/web/src/lib/office-legacy-redirect.ts with 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 from apps/web/src/lib/public-page-proxy.ts after any public-share exceptions. Cover the legacy URL and query in apps/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.ts and apps/gateway/src/office-mount.test.ts. Use distinct exact path exclusions in apps/gateway/src/mount-web-paths.ts for any Web-owned public share paths. Use the gateway’s shared matchMountWebPath check 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 in packages/utils/src/workspace-handle.ts and 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_APPS in packages/roadmap-core/src/live/host-probe.ts so the roadmap reports observed deployment status. Update apps/docs/platform/features/docs-markdown.mdx for Docs and apps/docs/platform/features/office-editors.mdx for Slides and Sheets with the new routes, compatibility ownership and links to the route, permission and share tests. Update apps/docs/platform/architecture/satellite-apps.mdx and add any new docs page to apps/docs/docs.json.

CI and release

  • Adapt .github/workflows/wiki-cloudflare.yaml to .github/workflows/<key>-cloudflare.yaml. The reusable workflow is .github/workflows/native-start-app.yaml. Keep its affected check, ready-for-ci gating, exact-source build metadata, dry run, hash/seal, emitted-Worker tests and restore tests. Copy scripts/ci/wiki-native-artifact.py to scripts/ci/<key>-native-artifact.py and substitute the Worker names, receipt name and source SHA env. Wire the workflow in the ci map and the held record in tuturuuu.ci.ts. Register the protected frontend and policy regression in scripts/ci/production-publication-policy.ts and scripts/ci/production-publication-policy.test.js. Copy Wiki’s planner sparse-checkout paths and reusable-workflow permissions. Register the PR gate and trigger digest in scripts/ci/pr-label-gate.js and scripts/ci/pr-label-gate.test.js. Update scripts/ci/ci-plan-catalog.json from cloudflareOwnership in scripts/ci/ci-plan.mjs, the run-decision inventory in scripts/ci/fixtures/workflow-run-decisions.json, and the production-profile build-identity list in scripts/ci/native-runtime-prerequisites.test.js.
  • Record the held app in productionPublicationExemptions in tuturuuu.ci.ts and as a held entry in scripts/ci/production-fleet.mjs. Add a private entry to packages/utils/src/seo-policy.json, run node scripts/generate-app-seo.js, and mirror the policy in cloudflare/worker.ts. List the generated robots.txt in the public assets registry and in the artifact script’s PUBLIC_FILES. Keep a next.config.ts with seoApp and use generateCommonMetadata in the locale layout. Ship the shared not-found.tsx, error.tsx and global-error.tsx status pages and a src/proxy.test.ts that loads the proxy. These registries run in turbo-unit-tests.yaml and docs-seo-check.yaml, not in check:changed.
  • Use VITE_DOCS_APP_NATIVE_PROFILE, VITE_SLIDES_NATIVE_PROFILE and VITE_SHEETS_NATIVE_PROFILE respectively, with staging and production values. Use DOCS_APP_SOURCE_SHA, SLIDES_SOURCE_SHA and SHEETS_SOURCE_SHA for artifact sealing. For a base-bound build use TUTURUUU_BASE_PATH with 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_URL and NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY. CI reads the public STAGING_SUPABASE_URL, STAGING_SUPABASE_PUBLISHABLE_KEY, PRODUCTION_SUPABASE_URL and PRODUCTION_SUPABASE_PUBLISHABLE_KEY variables. Register stage callback origins in NEXT_PUBLIC_TUTURUUU_INTERNAL_APP_DOMAINS on staging Web. Provision TUTURUUU_APP_COORDINATION_SECRET with the matching Web stage value for handoff verification. The shared auth boundary uses Supabase configuration for session and MFA verification. Provision SUPABASE_SECRET_KEY for 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’s CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID.
  • Run node scripts/check-internal-app-auth.js, the app’s routes:check, type-check, test and the exact-head ttr resources run -- bun check:changed gate. 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 expected x-tuturuuu-runtime header.
  • 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.jsonc to add the exact and nested paths to GATEWAY_MOUNTED_PATHS and bind MOUNT_DOCS, MOUNT_SLIDES or MOUNT_SHEETS to its Worker. Derive NEXT_PUBLIC_TUTURUUU_ACTIVE_APP_MOUNTS using scripts/active-app-mounts.mjs after the binding passes acceptance. Add each base to PENDING_WEB_MOUNTS if 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.