Skip to content

Environment variables

PatternYard is wired together almost entirely through environment variables — there are no hardcoded cross-service URLs left in the deployed code. This page is the map of which variable lives where.

Editor (patternyard-studio) — build-time roots

Section titled “Editor (patternyard-studio) — build-time roots”

These resolve in src/lib/pm-config.js via webpack DefinePlugin. They are inlined at build time, so changing one requires a redeploy. Each must be present in both the project env and the DefinePlugin allowlist to take effect.

KeyPoints at
PM_API_ROOThttps://api.patternyard.dev
PM_EXTENSIONS_ROOThttps://extensions.patternyard.dev
PM_DOCS_ROOThttps://docs.patternyard.dev
PM_LIBRARY_ROOThttps://library.patternyard.dev
PM_ASSET_CDN_ROOThttps://library.patternyard.dev
PM_HOME_ROOThttps://patternyard.dev

Home (patternyard-home) — public build vars

Section titled “Home (patternyard-home) — public build vars”

Imported via $env/static/public, so a missing one hard-fails the build. Must exist in Production, Preview, and Development.

KeyValue
PUBLIC_API_URLhttps://api.patternyard.dev
PUBLIC_STUDIO_URLhttps://studio.patternyard.dev
PUBLIC_CAPTCHA_ENABLEDtrue
PUBLIC_MAX_UPLOAD_SIZE32

The only project that holds storage credentials, plus the cross-service URLs used for redirects, share links, mod-log embeds, and email-verification links.

KeyRole
ApiURLThis backend’s own public origin (https://api.patternyard.dev)
HomeURLHome origin — share links, redirects
StudioURLEditor origin — used in the CORS allowlist
MONGODB_URI / database URLPrimary datastore
REDIS_URL / KV_*Sessions, cache, rate limits
BLOB_READ_WRITE_TOKENVercel Blob access for assets
limit/toggle vars (EmailLimit, MaxViews, UploadingEnabled, …)Operational tuning

The backend’s CORS allowlist includes both editor and home origins, because the editor is a separate origin making credentialed calls:

  • https://studio.patternyard.dev
  • https://patternyard.dev (and the www. variant)

If a credentialed editor → backend call starts failing, the allowlist is the first thing to check.