Skip to content

Secrets

EnvironmentStorageHow they reach the running process
Local devDoppler project kottia-com, branch config dev_local (inherits dev, overrides the localhost infra + workstation tooling keys); binding pinned in the repo-root doppler.yamldoppler run -- <cmd> injects them as process env. The repo-root .env.local is the no-Doppler fallback: Bun --env-file, Vite loadEnv and the e2e seed all fill only keys the environment does not already set.
Dev (deployed)Doppler project kottia-com: root config dev is the shared layer (synced to nothing); branches dev_api → Railway api, dev_web → svelte-web, dev_worker → worker, pushed by the Doppler → Railway integration (one-way; edit in Doppler, not in Railway). Internal wiring stays a Railway service reference, stored escaped in Doppler (\${{valkey.VALKEY_URL}}). Setup + rules: deploy/README.md § Secrets and integrations.Railway injects service variables at runtime and passes matching variables as Docker build arguments for declared ARGs. Secret values stay out of .railway/railway.ts and source control.
Staging + ProductionDoppler root configs stg / prd (key skeletons exist: every key present, non-secret knobs filled, secrets empty); GCS access is Workload Identity, so no static storage keys exist in either tierDoppler → GCP Secret Manager sync (automatic multi-region replication), injected into Cloud Run at deploy; rotation is a Doppler edit that the sync turns into a secret-version bump. Decided, not provisioned yet — see Production landscape.
Native mobile buildsPer-app build config (buildConfigField / build settings) + gitignored signing/keystore filesCompiled into the binary at native build time; client-safe values only.

Doppler holds every variable an app service reads — “public” or not — because the sync owns the service’s whole variable set and one config must be the complete spec of a deployment. What differs per class is the value, not the home:

ClassExamplesHomePer tier?
Platform wiringDATABASE_URL, DIRECT_URL, VALKEY_URL, VALKEY_DURABLE_URL, MEILISEARCH_HOST, MEILISEARCH_*_KEY, PORTTier root config. DEV stores escaped Railway references (\${{postgres.DATABASE_URL}}, \${{valkey-volatile.VALKEY_URL}}, \${{valkey.VALKEY_URL}}, \${{meilisearch.…}}) that Railway resolves after the sync; GCP tiers hold the literal private-IP URLs (rediss:// + VALKEY_CA_CERT)yes
Tier topologyORIGIN, CORS_ORIGINS, PUBLIC_API_URL, BETTER_AUTH_URL(_API), COOKIE_DOMAIN, QUEUE_SUFFIX, TRUSTED_PROXY_CIDRS, SENTRY_ENVIRONMENT, feature flagsTier root config; a service’s branch config when that service differsyes
Third-party secretsStripe, FacturAPI, Knock, Resend, GetStream, Google, Anthropic / Black Forest Labs, Sentry token, CloudflareTier root config — a separate vendor key set per tieryes
Client-safe PUBLIC_*PUBLIC_GETSTREAM_API_KEY, PUBLIC_KNOCK_*, PUBLIC_GOOGLE_MAPS_BROWSER_KEY, PUBLIC_POSTHOG_*Same as above — client-safe is about exposure, not ownershipyes
Build-time ARGsPUBLIC_API_URL, VITE_SENTRY_DSN, SENTRY_AUTH_TOKEN / SENTRY_ORG / SENTRY_PROJECTDoppler → Railway service variable → Docker ARG (unchanged mechanism)yes
Workstation toolingE2E_*, PLAYWRIGHT_BASE_URL, DEV_REFRESH_*, FIREBASE_*, APPLE_TEAM_ID, KNOCK_SERVICE_TOKENdev_local only — never in a root config, never in stg / prdno
CI vendor syncKNOCK_SERVICE_TOKEN, a test-mode STRIPE_SECRET_KEY (restricted key: Products, Prices, Webhook Endpoints, Billing Portal), PUBLIC_GETSTREAM_API_KEY, GETSTREAM_API_SECRET; variable STRIPE_WEBHOOK_URLGitHub environment development (branch-restricted), read only by ci.yml’s vendor-sync job on development pushes. GitHub environment production holds the KNOCK_SERVICE_TOKEN the manual knock.yml promotion reads. The only credentials in GitHub Actions.no
Platform layerR2 credentials, IMGPROXY_KEY / IMGPROXY_SALT, imgproxy bind/port/S3 settingsDoppler project kottia-infra (dev / stg / prd), synced to the imgproxy service. kottia-com holds cross-project references (${kottia-infra.dev.IMGPROXY_KEY}) to the shared values, never copiesyes
Not in DopplerRAILWAY_GIT_COMMIT_SHA, image ENV (NODE_ENV, HOST, BODY_SIZE_LIMIT), the data stores’ own variables (postgres, valkey, valkey-volatile, meilisearch, docs)Railway / Dockerfile / IaC preserve()—

Shared constants are duplicated per tier rather than referenced across configs, so prd never depends on another environment. PII_ENCRYPTION_KEY is generated per tier and never copied between tiers.

CategoryServer-onlyClient-safe
DatabaseDATABASE_URL, DIRECT_URL—
AuthBETTER_AUTH_SECRET, GOOGLE_CLIENT_SECRETGOOGLE_CLIENT_ID (public on OAuth consent)
Cache / queuesVALKEY_URL, VALKEY_DURABLE_URL (incl. passwords)—
SearchMEILISEARCH_ADMIN_API_KEYMEILISEARCH_SEARCH_API_KEY (read-only, scoped to public indexes)
StorageAWS_SECRET_ACCESS_KEY—
Image proxyIMGPROXY_KEY, IMGPROXY_SALTimgproxy URLs (signed)
EmailRESEND_API_KEY—
ChatGETSTREAM_API_SECRETPUBLIC_GETSTREAM_API_KEY (public-by-design, gated by server-issued user tokens)
NotificationsKNOCK_SECRET_API_KEY, KNOCK_FCM_CHANNEL_ID, KNOCK_APNS_CHANNEL_IDPUBLIC_KNOCK_API_KEY, PUBLIC_KNOCK_FEED_CHANNEL_ID
MapsGOOGLE_MAPS_API_KEY (server)Android Maps key in the Android project (iOS uses MapKit — no key); restricted by package name + signing-cert SHA-1
AnalyticsSENTRY_AUTH_TOKEN, POSTHOG_PERSONAL_API_KEYSENTRY_DSN, PUBLIC_POSTHOG_KEY
AIANTHROPIC_API_KEY, BFL_API_KEY, AI_STAGING_USER_HASH_SECRET—
PaymentsSTRIPE_SECRET_KEY, STRIPE_WEBHOOK_SIGNING_SECRET— (hosted Checkout, so no publishable key ships — there is no Stripe.js on the client)
Fiscal / CFDIFACTURAPI_SECRET_KEY (the FACTURAPI_PRODUCT_KEY / _UNIT_KEY / _PAYMENT_FORM overrides are SAT catalog values, not secrets)—
Fiscal dataPII_ENCRYPTION_KEY — non-re-issuable, see below—

Every secret above this line can be replaced. Lose RESEND_API_KEY and you issue a new one; lose AI_STAGING_USER_HASH_SECRET and the old pseudonyms stop correlating, which costs nothing anyone can name. The rotation procedure below assumes exactly that, and its first step — “issue a new credential in the provider dashboard” — is meaningless for a key with no dashboard behind it.

PII_ENCRYPTION_KEY is the first secret in this repo that does not work that way.

It is a data-encrypting key. It is self-generated (openssl rand -base64 32), no provider holds a copy, and it is the only thing that can read tax_profiles.{taxId,legalName,zip,email} and cfdi_documents.{receiverTaxId,receiverLegalName} — the RFC, razón social and fiscal domicile of every paying customer (FSR-014, packages/api/src/services/pii-crypto.ts).

Consequences that follow from that, and are not optional:

  • An escrowed copy must exist outside both Railway and Dokploy. A deployment-platform account problem must not be the same event as permanent data loss.
  • The owner must verify that escrow before the Hostinger VPS is cancelled. This page intentionally does not invent or assert a vault/location; owner verification is still required.
  • Never derive it from another secret, and never reuse it. Coupling it to something with a routine rotation cadence is exactly the mistake documented under BETTER_AUTH_SECRET below.
  • Rows written before FSR-014 shipped are plaintext at rest and stay readable with or without the key, which is what makes a rollback safe — it does not make the key optional for anything written since.
  1. Issue a new credential in the provider dashboard (Better Auth, Resend, Knock, etc.).
  2. Update the value in Doppler (kottia-com / dev, or the owning service’s branch config) first — the Railway sync pushes it to DEV and redeploys. Never edit the Railway variable directly; the next sync reverts it. Take the dev_local snapshot first (below) if the key is also used locally.
  3. Redeploy and verify nothing breaks.
  4. Update STG (once it exists) — the same key in the Doppler stg config; the Secret Manager sync creates the new version, then redeploy and verify. Skipping STG defeats the reason it exists: rotation is exactly the class of change that should break on a rehearsal tier rather than in production.
  5. Update production the same way (once it exists).
  6. Revoke the old credential in the provider dashboard.

For BETTER_AUTH_SECRET rotation: rotating the secret invalidates all sessions. Coordinate with the team so users get a single sign-out event instead of a silent log-out mid-flow.

For IMGPROXY_KEY / IMGPROXY_SALT rotation: all currently rendered HTML pages and SSR caches still hold URLs signed with the old key. Either (a) keep the old key alongside the new for an overlap window (imgproxy supports multiple keys), or (b) accept a short window of broken images while pages re-render.

BFL_API_KEY belongs only on the worker; apps/api holds no AI provider credential and no staging webhook. Rotate it by issuing a new key in the Black Forest Labs dashboard, updating the worker, and redeploying with AI_ROOM_STAGING_ENABLED=false; tasks already created keep polling under the new key.

Any client-side key compiled into a native binary ships to user devices. Anyone with the IPA / APK can extract these keys (via strings, decompilation, or sniffing the first network request).

Provider-side restrictions are mandatory before public ship. See Architecture → Deployment for the per-key restriction recipes.

Server-only secrets like GETSTREAM_API_SECRET and KNOCK_SECRET_API_KEY must never be shipped to a mobile bundle. They belong in apps/api’s env (Doppler dev_local locally, the Doppler dev_api config — inheriting dev — synced to Railway’s api service in deployed DEV) — never in any client app.

  • No .env* (except .env.example) committed.
  • No *_vault.yml (decrypted) committed.
  • No *.tfvars (real values) committed.
  • No google-services.json committed.
  • No *.pem / *.jks committed.
  • Railway build/deploy logs and GitHub Actions logs contain no secret values.
  • PII_ENCRYPTION_KEY was copied verbatim and its off-platform escrow was owner-verified before Hostinger cancellation.
  • Sentry beforeSend scrubber is installed in every Sentry init.
  • Mobile builds have provider-side API key restrictions applied.