Variables

Settings and secrets for your app, such as API keys, outside your code; per environment and without rebuilding.

Variables are settings for your app, such as API keys, a mode or an address. They don’t live in your code but at Cubli, and your app reads them as environment variables. Cubli stores them encrypted.

Set a variable

  1. Open your project, click your app and choose the Variables tab.
  2. Click Variable and fill in the Name and Value.
  3. Is it a secret, such as an API key? Tick Secret. The value is then hidden from AI tools too.
  4. Click Save, then Apply.

Your app restarts within a few seconds with the new values, without a new build. If nothing is deployed yet, they apply from the first deploy.

Have a .env file? Click .env to edit all variables as a .env file, or paste a whole .env into the name field.

With the CLI

cubli vars
cubli vars set STRIPE_KEY=sk_live_... MODE=live
cubli vars unset MODE

This works on the app linked to your folder. See CLI commands.

Variables for the browser

Variables your frontend uses in the browser, such as VITE_* or NEXT_PUBLIC_*, are built into your code during the build. So set them before you deploy, and deploy again after changing them. Restarting is not enough for those.

Want to know which variables your app expects? cubli check reads your folder and lists them.

What Cubli sets itself

  • PORT: the port your app must listen on.
  • CUBLI_URL: your site’s primary address.
  • Variables from connected databases, such as DATABASE_URL. They are listed under From connected databases and kept up to date automatically. See Add and connect databases.

Per environment

Production and staging each have their own variables. When you add staging they are copied; after that you change them separately. If you promote a version from staging to production, production keeps its own variables.

If you roll back to an earlier version, the variables that version ran with come back too.

Was this helpful?

Stuck? Mail support@cubli.io, or ask from your dashboard: Help