Skip to content

Environment Config

This page consolidates config for local and production Bookmarks deployments.

  • DB (D1): Bookmarks database (bookmarks)
  • AUTH_SERVICE (service binding): cosmos-auth-worker (current) or bookmarks-auth-worker (target)
  • DISCUSSION_ROOM (Durable Object): realtime room class
  • BOOKMARKS_MEDIA (R2): media bucket (bookmarks-media)
VariableLocal defaultProduction
AUTH_MODEdevservice
APP_URLhttps://bookmarksapp.cosmosdigitalservices.comhttps://bookmarksapp.cosmosdigitalservices.com
CORS_ORIGINSincludes localhost + app URLincludes deployed app URL(s)

Notes:

  • AUTH_MODE=dev enables local/dev auth behavior.
  • AUTH_MODE=service expects first-party auth via AUTH_SERVICE.
  • APP_URL is used for auth verification redirects (/v1/auth/verify -> ${APP_URL}/verify-email).
  • Keep CORS_ORIGINS aligned with deployed app origins.

Primary runtime define used in local/dev:

  • API_BASE_URL (for example http://127.0.0.1:8787 locally, worker domain in prod)
VariablePurpose
PUBLIC_BOOKMARKS_APP_URLURL used by /auth/open-app redirect to app shell
PUBLIC_APP_LOGIN_URLOptional override for login CTA target

Notes:

  • Canonical app URL is https://bookmarksapp.cosmosdigitalservices.com.
  • Site now normalizes legacy app.bookmarks.cosmosdigitalservices.com to canonical host at runtime.
  • Continue setting canonical env values and redeploying when env changes.

The API worker relies on an auth worker (cosmos-auth-worker current, bookmarks-auth-worker target) being correctly configured.

Minimum expected production configuration:

  • APP_URL points to deployed Bookmarks app URL.
  • MAIL_SERVICE binding is healthy for verification/reset emails.
  • JWT_SECRET configured.
  • ENCRYPTION_KEY configured.

Recommended dedicated Bookmarks mail dependency:

  • MAIL_SERVICE -> bookmarks-mail-worker (instead of shared cosmos-mail-worker)
  • GET /health returns ok: true from bookmarks API worker.
  • Login/register/refresh proxies succeed.
  • Authenticated /v1/me returns user context.
  • Club stream websocket connects for a club member.