Deploy to Vercel
Vercel is the primary deployment target. The Express app runs as one Node serverless function. Configure its environment as described in Vercel environment; for other hosts see Node host.[1]
Prerequisites
- Node 22+ and the pnpm version of the root
packageManager. - The Vercel CLI, installed globally; it is not a repository dependency:
npm install --global vercelorpnpm add -g vercel. vercel login, and a project linked withvercel link, which writes the gitignored.vercel/project.json. A free Hobby account works; XYZ needs no framework preset, so the project defaults can be kept.[2]
How it is wired
The root vercel.json builds apps/xyz/server.js with @vercel/node, ships .varlock.blob, public/** and resources/** through includeFiles, and routes /(.*) to the function.[3] The v4 api/api.js entry and the per-endpoint rewrites are gone.
- No build command runs on Vercel. The MAPP bundles in
public/js/lib,public/css/mapp.cssandpublic/css/ui.cssupload from the local working tree. They are gitignored on the development branches, so build them first unless deploying frommainor a release tag, see release builds. server.jsskipsapp.listen()whenVERCELis set and exports the app for@vercel/node.[4]DIRprefixes every route; the catch-all route needs no change.
What ships
@vercel/node traces imports from apps/xyz/server.js. A file read from disk at runtime must be in includeFiles. .vercelignore excludes .env*, *.md, apps/mapp, apps/ui, apps/xyz/tests, packages/devdb and packages/testhost, so pnpm on Vercel never installs PGlite.[5]
Runtime file reads resolve from XYZ_CWD or the repository root:
| Variable | File read |
|---|---|
SECRET_KEY | the path set, unless the value is the PEM itself |
SIGN_<KEY> | <KEY>.pem |
KEY_CLOUDFRONT | the matching *.pem |
FILE_RESOURCES (default resources) | resource files, not publicly served |
WORKSPACE=file:... | the workspace JSON |
*.pem files are gitignored and upload from the working copy; add them to includeFiles when SECRET_KEY, SIGN_* or KEY_CLOUDFRONT use one. A SECRET_KEY value starting with -----BEGIN is the key itself, eg. from a secret manager, and needs no file.[6]
Deploy
pnpm deploy:vercel --env=production # build, rotate key, freeze blob, deploy
pnpm deploy:vercel --env=preview
vercel --prod # without a blob, after a build
vercel --target=previewutils/deploy-vercel.js builds the bundles, generates a key, freezes .varlock.blob, stores _VARLOCK_ENV_KEY in the target environment, then deploys.[7] Details and the other configuration options are in Vercel environment.
Each deployment gets its own URL; the project domain is on the Overview tab. .vercel/project.json links the folder to one project; run vercel link again, or remove .vercel, to deploy to another project.
Check, roll back, promote
vercel ls
vercel inspect <deployment-url>
vercel logs <deployment-url> --follow
vercel rollback # previous production deployment
vercel promote <deployment-url> # promote a validated previewSmoke routes: /, /api/workspace/locale and /public/js/lib/mapp.js, prefixed with DIR. promote re-points the production alias without a rebuild. Each deployment carries its own blob and key, so a key rotation does not break older deployments. Confirm a rollback serves traffic in the logs.
The auth and SAML apps
apps/auth and apps/saml import the XYZ app and mount more routes. Their vercel.json paths are relative to the repository root, so deploy from the root:
pnpm build --filter=@geolytix/mapp --filter=@geolytix/mapp-ui
vercel --prod --local-config=apps/saml/vercel.jsonDeploy each to its own Vercel project; every config claims /(.*). The SAML config ships the gitignored apps/saml/*.crt, apps/saml/*.pem and, for a SECRET_KEY file, apps/xyz/*.pem from the working copy. An invalid SAML configuration fails every request.
Headers
Response headers, eg. Cache-Control and a Content-Security-Policy, go in a headers array in vercel.json; the repository config has none. The browser console reports resources a CSP blocks. Derive a policy from the sources a workspace loads.
Continuous deployment
No workflow deploys the app, and Vercel Git integration deploys a checkout without the bundles. Deploy with pnpm deploy:vercel, or from a workflow which builds first, see Vercel environment.