Skip to content

Migrating a v4 fork ​

Guide draft development migration monorepo v5

What changes for a fork or custom host moving from the flat v4 repository to the v5 monorepo - entry points, file paths, Varlock, cookies, params and composeObj; use when updating a fork or a host which imports XYZ modules.

Resource and sources

v5 split the flat v4 repository (lib/, api/, mod/, root express.js) into the monorepo. A fork or a host which imports XYZ modules must change:[1]

  • Entry point. The server is apps/xyz/server.js; the root express.js and api/api.js are gone. Every import path changed. The @geolytix/xyz-app package exports only ./router, ./server and ./mod/*, with no default export. Build a custom server from createRouter(); see XYZ API.
  • File paths. file: references in workspaces and launch configurations resolve from XYZ_CWD, which defaults to the repository root. Remove ../../ prefixes. See Server.
  • Environment. Varlock replaces dotenv. A plain node apps/xyz/server.js reads no .env file; use pnpm dev or varlock run. See the Varlock README.
  • Cookies. COOKIE_PROPS defaults to Secure; HttpOnly; SameSite=Strict; Path=${DIR}.[2] A deployment on plain HTTP must set it without Secure.
  • Params. Middleware stores validated params on req._params. The default validateRequestAuth copies them to req.params, and the built-in endpoint modules copy them again.[3] A custom endpoint behind a custom chain must run Object.assign(req.params, req._params) itself.
  • composeObj. A host which composes workspace objects passes the user object, not a roles array: composeObj(obj, user).[4]
  • keyVerification. The v4 keyVerification() is gone. Provider request signature checks are in apps/auth/providerRequestSignature.js, which no server mounts by default.[5] A deployment relying on signed provider URLs mounts it in its own chain.
  • Library tests. MAPP and MAPP.UI browser test suites replace the v4 tests/lib and tests/browser suites; see TESTING.md.
  • MongoDB. The mongodb provider was removed.

Keeping a fork current ​

utils/sync-fork.js helps sync a fork with the upstream repository. Keep fork-specific code in plugins, workspace templates or a host app built on createRouter(), so upstream merges stay small.


  1. Monorepo Wiki page at revision 3fc379b ↩︎

  2. apps/xyz/mod/utils/processEnv.js ↩︎

  3. apps/xyz/mod/middleware/validateRequestAuth.js ↩︎

  4. apps/xyz/mod/workspace/composeObj.js ↩︎

  5. apps/auth/providerRequestSignature.js ↩︎

XYZ v5.1.0. Generated from knowledge/ at dd7a6fa27736502733499c1bf485f15659b10338. Concepts marked draft are not reviewed.