Running locally
Install, build and configure the environment first, see local development. This concept replaces the run sections of SETUP.md.[1]
Dev scripts
pnpm dev # @geolytix/xyz-app through Varlock
pnpm dev:auth # apps/auth
pnpm dev:saml # apps/saml, see apps/saml/README.mdEach runs varlock run -- node --inspect server.js in its app through Turborepo, so the root .env is read and a debugger can attach.[2]
The server listens on PORT, default 3000: http://localhost:3000/, or http://localhost:3000/xyz with DIR=/xyz. server.js skips app.listen() only when VERCEL is set.[3]
node apps/xyz/server.js also starts the server, but reads no .env. The environment must then come from the shell, the launch configuration or the platform.[4]
VS Code launch configurations
A node launch of apps/xyz/server.js bypasses Varlock. Give it the variables as env, or point envFile at the root .env. A node-terminal launch runs the dev script, so Varlock reads .env and .env.schema:
{
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch with env",
"program": "apps/xyz/server.js",
"cwd": "${workspaceFolder}",
"env": { "TITLE": "Hello OSM!", "WORKSPACE": "file:./public/workspace.json" }
},
{
"type": "node",
"request": "launch",
"name": "Launch with .env",
"program": "apps/xyz/server.js",
"cwd": "${workspaceFolder}",
"envFile": "${workspaceFolder}/.env"
},
{
"type": "node-terminal",
"request": "launch",
"name": "Launch via Varlock",
"command": "pnpm --filter @geolytix/xyz-app dev",
"cwd": "${workspaceFolder}"
}
]
}envFile reads plain values only; gsm() references in .env resolve through Varlock alone. The same env object can be added to vercel.json, see Vercel environment.
First run checks
/shows the default view with the OSM layer ofpublic/workspace.json./api/workspace/localereturns the resolved locale./public/js/lib/mapp.jsreturns the built bundle.
Prefix each path with DIR when it is set. Without a WORKSPACE the server starts, but the view has no locale or layer to show.
Troubleshooting
- Startup or ESM errors: check
node --versionis 22 or later. - Inconsistent install: check
pnpm --versionmatches the rootpackageManager, thenpnpm installagain. - Blank view: check
.envis in the root and the launch reads it,WORKSPACEpoints at a valid source, the bundles are built (pnpm build), the server runs on the expectedPORT, and the path includesDIR. - Auth routes fail: set
SECRETorSECRET_KEY; tokens and cookies are signed with it. - Query or ACL failures: check the
DBS_*,PRIVATEandPUBLICvalues, which the XYZ modules read directly.