Skip to content

Deploy Studio to /_studio path in Vercel deployments#1166

Merged
hotlong merged 2 commits intomainfrom
claude/deploy-studio-to-vercel
Apr 16, 2026
Merged

Deploy Studio to /_studio path in Vercel deployments#1166
hotlong merged 2 commits intomainfrom
claude/deploy-studio-to-vercel

Conversation

@Claude
Copy link
Copy Markdown
Contributor

@Claude Claude AI commented Apr 16, 2026

Studio SPA was being served from the root path in Vercel deployments. Now serves from /_studio to separate it from API routes and future root-level content.

Changes

Build script (apps/server/scripts/build-vercel.sh):

  • Copy studio dist to public/_studio/ instead of public/

Vercel configuration (apps/server/vercel.json):

  • Add VERCEL: "true" to build env
  • Update asset cache headers: /_studio/assets/* instead of /assets/*
  • Add rewrites for /_studio and /_studio/* to serve Studio SPA

Vite configuration (apps/studio/vite.config.ts):

  • Set base: '/_studio/' when VERCEL env var is present
  • Ensures all asset references use correct path prefix

Result

  • Studio accessible at https://domain.vercel.app/_studio
  • API routes remain at https://domain.vercel.app/api/*
  • Non-Vercel deployments unaffected (use relative paths)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 16, 2026

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

Project Deployment Actions Updated (UTC)
objectstack-demo Ready Ready Preview, Comment Apr 16, 2026 8:42am
spec Ready Ready Preview, Comment Apr 16, 2026 8:42am

Request Review

Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/654bbb65-8c26-44b9-9053-6cc317b8aceb

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@Claude Claude AI requested a review from hotlong April 16, 2026 08:40
@hotlong hotlong marked this pull request as ready for review April 16, 2026 08:43
Copilot AI review requested due to automatic review settings April 16, 2026 08:43
@hotlong hotlong merged commit 7829cc0 into main Apr 16, 2026
13 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the Vercel deployment layout so the Studio SPA is served from /_studio instead of the root path, keeping API routes under /api/* and decoupling Studio from future root-level content.

Changes:

  • Update Studio build base path on Vercel to /_studio/ via Vite config.
  • Copy Studio dist/ output into apps/server/public/_studio/ during Vercel build.
  • Update vercel.json headers/env and add /_studio routing rules.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
apps/studio/vite.config.ts Sets Vite base to /_studio/ when building on Vercel so asset URLs resolve correctly.
apps/server/vercel.json Adds build env var and updates headers/redirects/rewrites intended to serve the Studio SPA under /_studio.
apps/server/scripts/build-vercel.sh Copies Studio build output into public/_studio/ for Vercel static hosting.

Comment thread apps/server/vercel.json
"rewrites": [
{ "source": "/api/:path*", "destination": "/api/[[...route]]" },
{ "source": "/((?!api/).*)", "destination": "/index.html" }
{ "source": "/_studio/(.*)", "destination": "/_studio/$1" },
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The current rewrite rules don’t provide an SPA fallback for deep Studio routes (e.g. /_studio/settings). /_studio/(.*) -> /_studio/$1 is effectively a no-op and will 404 when the file doesn’t exist. Update rewrites to route all non-asset /_studio/:path* requests to /_studio/index.html (while leaving /_studio/assets/* to serve static files).

Suggested change
{ "source": "/_studio/(.*)", "destination": "/_studio/$1" },
{ "source": "/_studio/assets/:path*", "destination": "/_studio/assets/:path*" },
{ "source": "/_studio/:path*", "destination": "/_studio/index.html" },

Copilot uses AI. Check for mistakes.
Comment thread apps/server/vercel.json
Comment on lines +27 to +29
"redirects": [
{ "source": "/", "destination": "/_studio", "permanent": false }
],
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The PR description mentions separating Studio from “future root-level content”, but this redirect forces / to always go to /_studio, which would block serving anything else at the root later. Consider removing this redirect (or making it conditional/temporary) so / remains available.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants