From 3d31a7261bc45d87460329aea06e6f1454f56411 Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Tue, 14 Apr 2026 06:16:21 +0000 Subject: [PATCH 1/2] feat(app-host): load studio UI on homepage - Build studio alongside app-host in build-vercel.sh - Copy studio dist files to app-host public/ directory - Add SPA routing to serve studio UI for non-API routes - Add cache headers for static assets Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/13b58dad-d5c4-4665-b3dd-b92c8b773190 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> --- examples/app-host/scripts/build-vercel.sh | 21 +++++++++++++++++---- examples/app-host/vercel.json | 11 ++++++++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/examples/app-host/scripts/build-vercel.sh b/examples/app-host/scripts/build-vercel.sh index aba537113..3b70d99d9 100755 --- a/examples/app-host/scripts/build-vercel.sh +++ b/examples/app-host/scripts/build-vercel.sh @@ -7,20 +7,33 @@ set -euo pipefail # - api/[[...route]].js is committed to the repo (Vercel detects it pre-build) # - esbuild bundles server/index.ts → api/_handler.js (self-contained bundle) # - The committed .js wrapper re-exports from _handler.js at runtime +# - Studio SPA is built and copied to public/ for serving the UI # # Steps: -# 1. Build the project with turbo +# 1. Build the project with turbo (includes studio) # 2. Bundle the API serverless function (→ api/_handler.js) -# 3. Copy native/external modules into local node_modules for Vercel packaging +# 3. Copy studio dist files to public/ for UI serving echo "[build-vercel] Starting app-host build..." # 1. Build the project with turbo (from monorepo root) +# This builds both app-host and studio cd ../.. -pnpm turbo run build --filter=@example/app-host +pnpm turbo run build --filter=@example/app-host --filter=@objectstack/studio cd examples/app-host # 2. Bundle API serverless function node scripts/bundle-api.mjs -echo "[build-vercel] Done. Serverless function in api/[[...route]].js → api/_handler.js" +# 3. Copy studio dist files to public/ for UI serving +echo "[build-vercel] Copying studio dist to public/..." +rm -rf public +mkdir -p public +if [ -d "../../apps/studio/dist" ]; then + cp -r ../../apps/studio/dist/* public/ + echo "[build-vercel] ✓ Copied studio dist to public/" +else + echo "[build-vercel] ⚠ Studio dist not found (skipped)" +fi + +echo "[build-vercel] Done. Static files in public/, serverless function in api/[[...route]].js → api/_handler.js" diff --git a/examples/app-host/vercel.json b/examples/app-host/vercel.json index 7c2d6eca0..b5d49f112 100644 --- a/examples/app-host/vercel.json +++ b/examples/app-host/vercel.json @@ -9,7 +9,16 @@ "maxDuration": 60 } }, + "headers": [ + { + "source": "/assets/(.*)", + "headers": [ + { "key": "Cache-Control", "value": "public, max-age=31536000, immutable" } + ] + } + ], "rewrites": [ - { "source": "/api/:path*", "destination": "/api/[[...route]]" } + { "source": "/api/:path*", "destination": "/api/[[...route]]" }, + { "source": "/((?!api/).*)", "destination": "/index.html" } ] } From 452c71828a1978a2ea7e458316bf3d285aac45ba Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Tue, 14 Apr 2026 06:30:14 +0000 Subject: [PATCH 2/2] fix(app-host): remove .npmrc to fix Vercel pnpm install conflict The app-host/.npmrc with node-linker=hoisted was causing pnpm install conflicts on Vercel (ERR_PNPM_EEXIST). Studio doesn't have a local .npmrc and works fine, so removing it to match that pattern. Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/9f2af2b5-3ebb-470a-944d-918293a36a82 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> --- examples/app-host/.npmrc | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 examples/app-host/.npmrc diff --git a/examples/app-host/.npmrc b/examples/app-host/.npmrc deleted file mode 100644 index 4a3d47b9a..000000000 --- a/examples/app-host/.npmrc +++ /dev/null @@ -1,3 +0,0 @@ -# Vercel pnpm configuration -# Use hoisted node_modules structure instead of symlinks to avoid Vercel packaging errors. -node-linker=hoisted