Deploy Studio to /_studio path in Vercel deployments#1166
Conversation
Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/c3e7d4a1-2f6f-49da-9c2b-064f55111697 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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>
There was a problem hiding this comment.
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 intoapps/server/public/_studio/during Vercel build. - Update
vercel.jsonheaders/env and add/_studiorouting 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. |
| "rewrites": [ | ||
| { "source": "/api/:path*", "destination": "/api/[[...route]]" }, | ||
| { "source": "/((?!api/).*)", "destination": "/index.html" } | ||
| { "source": "/_studio/(.*)", "destination": "/_studio/$1" }, |
There was a problem hiding this comment.
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).
| { "source": "/_studio/(.*)", "destination": "/_studio/$1" }, | |
| { "source": "/_studio/assets/:path*", "destination": "/_studio/assets/:path*" }, | |
| { "source": "/_studio/:path*", "destination": "/_studio/index.html" }, |
| "redirects": [ | ||
| { "source": "/", "destination": "/_studio", "permanent": false } | ||
| ], |
There was a problem hiding this comment.
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.
Studio SPA was being served from the root path in Vercel deployments. Now serves from
/_studioto separate it from API routes and future root-level content.Changes
Build script (
apps/server/scripts/build-vercel.sh):public/_studio/instead ofpublic/Vercel configuration (
apps/server/vercel.json):VERCEL: "true"to build env/_studio/assets/*instead of/assets/*/_studioand/_studio/*to serve Studio SPAVite configuration (
apps/studio/vite.config.ts):base: '/_studio/'whenVERCELenv var is presentResult
https://domain.vercel.app/_studiohttps://domain.vercel.app/api/*