Skip to main content

Environment & Operations

Applies to: v3

Environment & Operations

Environment Bindings (wrangler)

  • API_KEY: required for public routes (API-key auth)
  • DIRECTUS_URL, DIRECTUS_USERNAME, DIRECTUS_PASSWORD: Directus access
  • CORS_ORIGIN: allowed origin(s)
  • JWT_PRIVATE_KEY, JWT_PUBLIC_KEY: JWT (RS256) secrets
  • COMPANY_IMAGES, CATEGORY_IMAGES, AVATAR_IMAGES, REPORT_IMAGES: R2 buckets
  • TURSO_DB_URL, TURSO_DB_AUTH_TOKEN: Turso (libSQL) database
  • ES_API_KEY, ES_API_URL: Elasticsearch access
  • GOUPC_API_KEY, GOUPC_API_URL: Go-UPC access
  • OPENFOODFACTS_API_KEY, OPENFOODFACTS_API_URL: Open Food Facts access
  • REVENUECAT_API_KEY, REVENUECAT_API_URL: Revenue Cat access

Local Development

  • Set all variables in .dev.vars.
  • Run npm run dev to start worker locally.

Database Migrations (Turso)

  • Push schema: npm run db:push
  • Generate: npm run db:generate
  • Apply: npm run db:migrate

Images (R2)

  • Copy company images from Directus to R2 using v2 copy endpoints (optionally writing file name mappings to KV).

Code references