Help forum

Deploying different app instances/versions with different env variables

  • FeRojas

    10 months ago

    Is there an easy way to run the same app from a single repo as multiple instances, each with different environment variables and connected to different subdomains?

    Use case: I want to deploy identical versions of a web app (under same Nordcraft project), but each connected to a different subdomain and backend instance. The goal is to isolate different tenants so each business has its own subdomain and dedicated backend instance.

    I know that global formulas could be use like a env variable (but expose to the client). Could they be used dynamically—so that based on the subdomain the app connects for example to a different SUPABASE_PROJECT_URL and SUPABASE_ANON_KEY (global formulas), so each subdomain connects to different Supabase projects? Any advice on this would be appreciated.
  • Erik Beuschau

    10 months ago

    Global formulas could definitely help you achieve this. A global formula could return a different URL/API key based on the [current URL](https://docs.nordcraft.com/references/formulas#current-url)
  • FeRojas

    10 months ago

    That was fast! jajaja. Thanks 👍 !