Files
Reactive-Resume/vercel.json
T
Amruth Pillai 725be158c0 feat(deploy): deploy Vercel as frontend and backend services
Vercel now deploys Reactive Resume as two services in one project:
`frontend` serves the static Vite build from apps/web/dist, and
`backend` runs the Hono server Function from apps/server. Top-level
rewrites send server-owned paths (/api, /uploads, /mcp, /.well-known,
robots.txt, sitemap.xml, llms.txt, schema.json, index.html) and every
path without a file extension to `backend`, so HTML shells keep their
injected SEO metadata. Paths with a file extension go to `frontend`.

The service builder needs a few accommodations:

- apps/server/vercel.mjs replaces api/index.mjs as the entrypoint,
  because a service entrypoint must exist before the build runs.
- `outputDirectory: "."` stops the builder from using the Docker
  entrypoint in dist/ as the Function handler.
- The builder loads external CommonJS dependencies through pnpm links
  that it leaves out of the Function. ioredis and react-reconciler are
  now bundled with their dependencies, and bcrypt is replaced with
  bcryptjs, which reads and writes the same $2b$ hashes.

The Vercel compatibility workflow now builds with the services
framework and loads a copy of the backend Function outside the
checkout, so a dependency missing from the Function fails CI. The stale
PDFKit trace checks are removed.

Existing Vercel installations must set Framework Preset to Services
before redeploying; the self-hosting guide documents this.
2026-09-30 00:17:24 +02:00

37 lines
1.2 KiB
JSON

{
"$schema": "https://openapi.vercel.sh/vercel.json",
"services": {
"frontend": {
"root": "apps/web",
"framework": "vite",
"buildCommand": "cd ../.. && pnpm build --filter=web",
"outputDirectory": "dist"
},
"backend": {
"root": "apps/server",
"runtime": "node",
"entrypoint": "vercel.mjs",
"buildCommand": "cd ../.. && pnpm build --filter=web --filter=server && node apps/server/dist/prepare-deployment.mjs",
"outputDirectory": ".",
"functions": {
"vercel.mjs": {
"maxDuration": 300,
"includeFiles": "{apps/web/dist/index.html,apps/web/dist-prerender/**,apps/server/dist/prompts/**}"
}
}
}
},
"rewrites": [
{ "source": "/api/(.*)", "destination": { "service": "backend" } },
{ "source": "/uploads/(.*)", "destination": { "service": "backend" } },
{ "source": "/mcp(/.*)?", "destination": { "service": "backend" } },
{ "source": "/\\.well-known(/.*)?", "destination": { "service": "backend" } },
{
"source": "/(index\\.html|robots\\.txt|sitemap\\.xml|llms\\.txt|schema\\.json)",
"destination": { "service": "backend" }
},
{ "source": "/(.*\\.[^/]+)", "destination": { "service": "frontend" } },
{ "source": "/(.*)", "destination": { "service": "backend" } }
]
}