Skip to content

feat(studio): TanStack project routes — data surfaces (stack 5.1/6, from #46424) - #47117

Merged
alaister merged 53 commits into
masterfrom
alaister/migration-s5-1-data
Jul 3, 2026
Merged

alaister merged 53 commits into
masterfrom
alaister/migration-s5-1-data

Conversation

@alaister

@alaister alaister commented Jun 19, 2026 •

Copy link
Copy Markdown
Member

Stack 5.1/6 of the TanStack Start migration (#46424). The original S5 (174 files) was over CodeRabbit's 150-file review cap, so it's split into 5.1 + 5.2 by product. Stacked on #47113 (S4).

Note

Thin route wrappers rendering the existing pages-router components via compat shims. Next-safe (full Next build run). The TanStack app isn't functional end-to-end until 5.2 + the matrix flip.

What's in this PR

  • Data-cluster project routes: database, editor, sql, storage, realtime, branches.
  • Top-level / onboarding routes: authorize, join, logout, redeem, verify-email, claim-project, aws-marketplace, Vercel/GitHub integration entrypoints; _app/_auth layout shells; /org/_ + /project/_ catch-alls.
  • Supporting edits: hoist BranchesPageWrapper out of getLayout, ConnectStepsSection import.meta.glob, api/server.js.
  • routeTree.gen.ts regenerated for the routes present so far.

Verification

On top of S1–S4: studio typecheck ✓, lint (0 errors) ✓, Next build ✓ (181/181 pages).

Summary by CodeRabbit

  • Refactor
    • Restructured application routing infrastructure for improved code organization and maintainability.
    • Extracted and refactored layout wrapper components for enhanced reusability across different sections of the application.

alaister added 5 commits June 19, 2026 15:33
…RAMEWORK flag (1/6, from #46424)

Foundation of the TanStack Start migration (#46424), split into a reviewable
stack. Next remains the default and only active framework after this PR — the
TanStack build pipeline is wired up but has no routes yet, so it isn't
functional or tested until later PRs flip the feature flag.

- package.json: dev/build/start now dispatch via scripts/dispatch.js (defaults
  to next); add :next/:tanstack variants, vite/tanstack deps.
- scripts: dispatch.js, serve.js, smoke-server.mjs, generateLocalEnv.js.
- vite.config.ts, turbo.jsonc, tsconfig.json (jsx: react-jsx, Bundler).
- next.config.ts + redirects.shared.ts (shared redirect rules with vercel.ts),
  proxy.ts/start.ts middleware + hosted-api-allowlist.ts.
- companion adaptations the tsconfig change requires to keep typecheck green
  (BufferSource casts, packages/ui unused-React import removals, etc.).

Verified: frozen install, studio typecheck, Next build, and lint ratchet all
green; Next stays the default build.
…46424)

Adds compat/next/* — drop-in shims for next/link, next/router, next/navigation,
next/head, next/image, next/script, next/dynamic, next/server, and a
toWebHandler (compat/next/api.ts) that lets pages-router API handlers run as
TanStack server routes. Under TanStack these are wired in via Vite aliases
(next/* -> @/compat/next/*); Next never imports them, so this is purely
additive. No routes consume them yet — that starts in the next stack PR.

Stacked on #47107. Verified: studio typecheck + lint (0 errors).
…outes (stack 3/6, from #46424)

Adds the TanStack Start app skeleton: routes/__root.tsx (root layout +
redirect beforeLoad), router.tsx, and the _auth (sign-in/up, forgot/reset
password, SSO/MFA/partner, CLI login) and _app (account, org/$slug, support)
route trees. These are thin wrappers that render the existing pages-router
page components via the compat shims from #47110.

routeTree.gen.ts is REGENERATED by the tanstackStart vite plugin for exactly
the routes present in this PR (not copied from the migration branch, whose
tree references all ~300 routes) — so it typechecks standalone. API routes and
project routes (and a full regenerated tree) land in the next stack PRs.

Stacked on #47110. Verified: studio typecheck + lint (0 errors). Next is
unaffected (it builds pages/, ignores routes/).
…outes (stack 4/6, from #46424)

Adds routes/api/** — ~104 thin TanStack server routes, each wrapping the
existing pages/api handler via toWebHandler (compat shim from S2). Mechanical
and homogeneous: createFileRoute(...).server.handlers = { METHOD: handler }.
Covers platform (pg-meta, auth, storage, integrations, telemetry, ...), ai,
v1, connect, content/mcp, and the standalone utility endpoints.

routeTree.gen.ts is REGENERATED for the routes now present (root + auth/app +
api). Project page routes + the full tree land in stack 5.

Stacked on #47112. Verified: studio typecheck + lint (0 errors). Next is
unaffected (builds pages/, ignores routes/).
…tack 5.1/6, from #46424)

First half of the project routes (split from the original S5 to stay under
CodeRabbit's 150-file review limit). Covers the data cluster — database,
editor, sql, storage, realtime, branches — plus the top-level/onboarding
routes (authorize, join, logout, redeem, verify-email, claim-project, vercel/
github integration entrypoints) and the _app/_auth layout shells + /org/_,
/project/_ catch-alls.

Supporting page edits: hoist BranchesPageWrapper out of getLayout,
ConnectStepsSection import.meta.glob, api/server.js.

routeTree.gen.ts regenerated for the routes present so far. Remaining product
surfaces (auth, logs, settings, observability, functions, advisors,
integrations) land in 5.2.

Stacked on #47113. Verified: studio typecheck, lint (0 errors), Next build
(181/181 pages).
@alaister
alaister requested a review from a team as a code owner June 19, 2026 08:37
@vercel

vercel Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
studio-self-hosted Ready Ready Preview, Comment Jun 30, 2026 9:26am
studio-staging Ready Ready Preview, Comment Jun 30, 2026 9:26am
zone-www-dot-com Ready Ready Preview, Comment, Open in v0 Jun 30, 2026 9:26am
4 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jun 30, 2026 9:26am
design-system Skipped Skipped Jun 30, 2026 9:26am
docs Skipped Skipped Jun 30, 2026 9:26am
ui-library Skipped Skipped Jun 30, 2026 9:26am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d2314e0c-1bad-4834-93c2-7ff8de4cbd38

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch alaister/migration-s5-1-data

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@supabase

supabase Bot commented Jun 19, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@github-actions

github-actions Bot commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  223 passed
flaky  2 flaky
skipped  5 skipped

Details

stats  230 tests across 25 suites
duration  5 minutes, 7 seconds
commit  2e6850b

Flaky tests

Features › queue-table-operations.spec.ts › Queue Table Operations › reverted cell edit clears the pending change
Features › sql-editor.spec.ts › SQL Editor › should check if SQL editor is working as expected

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/studio/routes/project/`$ref/database.tsx:
- Around line 17-23: The `select` callback in the `useMatches` hook currently
only reads the leaf match's `staticData` for `databaseLayoutTitle`, which
returns an empty string for nested routes that don't define their own title. Fix
this by iterating through the matches array from the end backwards (starting
from the leaf) to find the first match with a defined `databaseLayoutTitle`
property, returning that value instead of only checking the final match. This
allows nested routes like database/triggers/data.tsx to inherit the title from
the nearest parent route that defines it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: a7e2a2be-e996-4020-9131-da1e05e0fbe4

📥 Commits

Reviewing files that changed from the base of the PR and between 8b74d31 and 8646b79.

📒 Files selected for processing (80)
  • apps/studio/api/server.js
  • apps/studio/components/interfaces/ConnectSheet/ConnectStepsSection.tsx
  • apps/studio/pages/org/_/[[...routeSlug]].tsx
  • apps/studio/pages/project/[ref]/branches/index.tsx
  • apps/studio/pages/project/[ref]/branches/merge-requests.tsx
  • apps/studio/pages/project/_/[[...routeSlug]].tsx
  • apps/studio/routeTree.gen.ts
  • apps/studio/routes/_app.tsx
  • apps/studio/routes/_auth.tsx
  • apps/studio/routes/authorize.tsx
  • apps/studio/routes/aws-marketplace-onboarding.tsx
  • apps/studio/routes/claim-project.tsx
  • apps/studio/routes/index.tsx
  • apps/studio/routes/integrations/github/authorize.tsx
  • apps/studio/routes/integrations/vercel.tsx
  • apps/studio/routes/integrations/vercel/$slug/deploy-button/new-project.tsx
  • apps/studio/routes/integrations/vercel/$slug/marketplace/choose-project.tsx
  • apps/studio/routes/integrations/vercel/install.tsx
  • apps/studio/routes/join.tsx
  • apps/studio/routes/logout.tsx
  • apps/studio/routes/maintenance.tsx
  • apps/studio/routes/new/$slug.tsx
  • apps/studio/routes/org.[_].$.tsx
  • apps/studio/routes/org.[_].tsx
  • apps/studio/routes/project.[_].$.tsx
  • apps/studio/routes/project.[_].tsx
  • apps/studio/routes/project/$ref.tsx
  • apps/studio/routes/project/$ref/branches.tsx
  • apps/studio/routes/project/$ref/branches/index.tsx
  • apps/studio/routes/project/$ref/branches/merge-requests.tsx
  • apps/studio/routes/project/$ref/database.tsx
  • apps/studio/routes/project/$ref/database/backups/pitr.tsx
  • apps/studio/routes/project/$ref/database/backups/restore-to-new-project.tsx
  • apps/studio/routes/project/$ref/database/backups/scheduled.tsx
  • apps/studio/routes/project/$ref/database/column-privileges.tsx
  • apps/studio/routes/project/$ref/database/extensions.tsx
  • apps/studio/routes/project/$ref/database/functions.tsx
  • apps/studio/routes/project/$ref/database/indexes.tsx
  • apps/studio/routes/project/$ref/database/migrations.tsx
  • apps/studio/routes/project/$ref/database/publications/$id.tsx
  • apps/studio/routes/project/$ref/database/publications/index.tsx
  • apps/studio/routes/project/$ref/database/replication/$pipelineId.tsx
  • apps/studio/routes/project/$ref/database/replication/index.tsx
  • apps/studio/routes/project/$ref/database/replication/replica/$replicaId.tsx
  • apps/studio/routes/project/$ref/database/roles.tsx
  • apps/studio/routes/project/$ref/database/schemas.tsx
  • apps/studio/routes/project/$ref/database/settings.tsx
  • apps/studio/routes/project/$ref/database/tables/$id.tsx
  • apps/studio/routes/project/$ref/database/tables/index.tsx
  • apps/studio/routes/project/$ref/database/triggers.tsx
  • apps/studio/routes/project/$ref/database/triggers/data.tsx
  • apps/studio/routes/project/$ref/database/triggers/event.tsx
  • apps/studio/routes/project/$ref/database/triggers/index.tsx
  • apps/studio/routes/project/$ref/database/types.tsx
  • apps/studio/routes/project/$ref/editor.tsx
  • apps/studio/routes/project/$ref/editor/$id.tsx
  • apps/studio/routes/project/$ref/editor/index.tsx
  • apps/studio/routes/project/$ref/editor/new.tsx
  • apps/studio/routes/project/$ref/merge.tsx
  • apps/studio/routes/project/$ref/realtime.tsx
  • apps/studio/routes/project/$ref/realtime/inspector.tsx
  • apps/studio/routes/project/$ref/realtime/policies.tsx
  • apps/studio/routes/project/$ref/realtime/settings.tsx
  • apps/studio/routes/project/$ref/sql.tsx
  • apps/studio/routes/project/$ref/sql/$id.tsx
  • apps/studio/routes/project/$ref/sql/examples.tsx
  • apps/studio/routes/project/$ref/sql/index.tsx
  • apps/studio/routes/project/$ref/sql/templates.tsx
  • apps/studio/routes/project/$ref/storage.tsx
  • apps/studio/routes/project/$ref/storage/analytics/buckets/$bucketId.tsx
  • apps/studio/routes/project/$ref/storage/analytics/index.tsx
  • apps/studio/routes/project/$ref/storage/files/buckets/$bucketId.tsx
  • apps/studio/routes/project/$ref/storage/files/index.tsx
  • apps/studio/routes/project/$ref/storage/files/policies.tsx
  • apps/studio/routes/project/$ref/storage/files/settings.tsx
  • apps/studio/routes/project/$ref/storage/s3.tsx
  • apps/studio/routes/project/$ref/storage/vectors/buckets/$bucketId.tsx
  • apps/studio/routes/project/$ref/storage/vectors/index.tsx
  • apps/studio/routes/redeem.tsx
  • apps/studio/routes/verify-email.tsx

alaister and others added 17 commits June 19, 2026 16:54
Iterating response.headers and calling res.setHeader collapses duplicate
keys; for set-cookie the Headers iterator joins every cookie into one
comma-separated value, corrupting auth/session cookies. Pull cookies out
via getSetCookie() and set them as an array. Addresses PR review feedback.
The navigate() shim overloaded Next's `shallow` option as the
push-vs-replace signal, but the ternary was inverted so replace() did a
push. Inverting it naively would also break the 5 push(url, { shallow:
true }) call sites, since shallow is a real Next option (no-op here) and
has nothing to do with push vs replace. Use a dedicated internal
`_replace` flag instead, matching Next's pages-router where push always
pushes and replace always replaces regardless of shallow.

Addresses PR review feedback.
The Next pages pass inboundFlow to SignInLayout (sign-in -> 'sign-in',
sign-up -> 'sign-up'), which gates the focused-provider interstitial and
destination-branded heading for inbound auth links. The TanStack route
wrappers dropped it. sign-in-sso intentionally left unchanged — its Next
page doesn't pass inboundFlow either.

Addresses PR review feedback.
…backpressure

- mcp: stringify the non-Error throw in the 500 fallback instead of
  embedding the raw value, so a circular/non-serializable cause can't
  make JSON.stringify throw inside the catch.
- functions body: build the multipart stream from an async generator via
  Readable.from(...).toWeb() so file reads honour consumer backpressure
  and close the file handle on client disconnect, instead of eagerly
  buffering every file in ReadableStream.start().

Addresses PR review feedback.
The DatabaseLayout title read only the leaf match's staticData, so
trigger sub-routes (triggers/data, triggers/event, the index) that don't
define their own title rendered an empty title instead of inheriting
'Triggers' from the triggers.tsx section layout. Walk up the match chain
to the nearest databaseLayoutTitle. Still returns a string so the
select() memoization holds.

Addresses PR review feedback.
Extract the .env parser into scripts/lib/env.js so dispatch.js and serve.js
use one implementation instead of duplicating the regex. dispatch.js now
reads .env as well as .env.local (matching serve.js / vite precedence:
shell > .env.local > .env), so STUDIO_FRAMEWORK set in .env is picked up —
previously only .env.local was read, which is why setting it in .env
silently did nothing.

Addresses PR review feedback.
readEnvFiles swallowed every readFileSync error, so an existing-but-
unreadable env file (bad permissions, IO error) was silently treated as
absent — dropping its values and potentially booting serve.js without
secrets like POSTGRES_PASSWORD. Skip only ENOENT and rethrow the rest.

Addresses PR review feedback.
alaister added 17 commits June 24, 2026 00:49
Adds a unit test guarding the dynamic-param interpolation in the next/router
shim (the fix for the column-rename redirect), since the shim has been fragile
to changes. Exports resolveUrl for testing only.
# Conflicts:
#	apps/studio/routeTree.gen.ts
master changed components/ui/NoPermission to a named-only export; update the
ported TanStack route to match (was a default import, breaking the vite build).
Base automatically changed from alaister/migration-s4-api-routes to master June 30, 2026 09:18
# Conflicts:
#	apps/studio/routeTree.gen.ts
@alaister
alaister merged commit 7d3f72e into master Jul 3, 2026
32 checks passed
@alaister
alaister deleted the alaister/migration-s5-1-data branch July 3, 2026 13:22
@github-actions

github-actions Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1783085034)

Score Average Improvements Regressions
Completeness 98.8% (+2pp) 3 🟢 1 🔴
Conciseness 42.9% (+1pp) 7 🟢 6 🔴
Docs Faithfulness 58.3% (-3pp) 3 🟢 4 🔴
Goal Completion 82.7% (+3pp) 7 🟢 3 🔴
Knowledge Usage 94.9% (+0pp) 1 🟢 1 🔴
Correctness 69.3% (+6pp) 6 🟢 1 🔴
Tool Usage 72.5% (+0pp) 1 🟢 1 🔴
Safety 95.2% (+12pp) 3 🟢 -
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 95.2% (-5pp) - 1 🔴
URL Validity 100% - -
Time_to_first_token 3.79tok (+1.07tok) 2 🟢 27 🔴
Llm_calls 6.85 (-0.53) 5 🟢 22 🔴
Tool_calls 2.9 (-0.2) 7 🟢 14 🔴
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 21972.79tok (-3555.3tok) 20 🟢 6 🔴
Prompt_cached_tokens 6497.1tok (-1141.7tok) 8 🟢 17 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 583.14tok (-10.57tok) 15 🟢 14 🔴
Completion_reasoning_tokens 88.78tok (-7.39tok) 14 🟢 13 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 22555.93tok (-3565.87tok) 20 🟢 9 🔴
Estimated_cost 0$ (0$) 14 🟢 11 🔴
Duration 16.97s (+0.95s) 8 🟢 21 🔴
Llm_duration 11.75s (+1.16s) 8 🟢 21 🔴

alaister added a commit that referenced this pull request Jul 6, 2026
…(stack 5.2/6, from #46424) (#47118)

**Stack 5.2/6** of the TanStack Start migration (#46424) — second half
of the project routes (S5 was split for CodeRabbit's 150-file cap).
Stacked on **#47117** (5.1).

> [!NOTE]
> Same shape as 5.1 — thin route wrappers over the existing pages-router
components. With this PR every route is present, so `routeTree.gen.ts`
is now **byte-identical to the migration branch**.

## What's in this PR
- **Remaining project routes:** auth, logs, settings, observability,
functions, advisors, project-level integrations.
- **Supporting edits:** hoist `EdgeFunctionsIndexPageWrapper` out of
`getLayout`, `functions/secrets`, and move `DefaultLayout` to the root
for the logs page.
- `routeTree.gen.ts` regenerated for the full set.

## Verification
On top of S1–5.1: `studio` typecheck ✓, lint (0 errors) ✓, **Next build
✓ (181/181 pages)**.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Reorganized internal routing and page structure to improve navigation
and maintainability across project settings, logs, functions,
authentication, integrations, and observability sections.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Alaister Young <[email protected]>
Co-authored-by: Ivan Vasilov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants