---
url: https://kit.kambium.net/docs/environment-variables.md
---
# Configuration

Connect your hosted app to its database, email and other services while keeping
development and production settings separate.

For a newly generated app, use Fly secrets for private runtime values and
`[env]` in the selected Fly TOML for commit-safe settings such as the app URLs,
Supabase URL and publishable key. Desktop can also [manage an environment's
secrets in Doppler](https://kit.kambium.net/docs/setup.md#doppler). Local Server supplies its own settings.

<span id="save-and-edit-settings"></span>

Keep encryption keys across deployments so existing data remains readable.
Supply provider credentials as your engines need them.

<span id="app-urls"></span>

::: details App URLs

Set `API_BASE_URL` to the backend's HTTPS origin and `SERVE_BASE_URL` to the
hosted dashboard origin. For hosted development on your machine, these can be
`http://127.0.0.1:3000` and `http://127.0.0.1:5173`.

When the [dashboard and backend share a Fly app](https://kit.kambium.net/docs/dashboard-deployment.md),
both can use the same HTTPS origin. `SERVE_BASE_URL` sets the dashboard origin
for links and redirects. Desktop also uses it to include the dashboard in the
Fly image.

:::

<span id="supabase"></span>

::: details Where to find Supabase keys and the email signing secret

Copy the project URL and publishable key from Supabase's
[Connect dialog](https://supabase.com/dashboard/project/_?showConnect=true).
Copy or create the backend secret key in
[Settings → API Keys](https://supabase.com/dashboard/project/_/settings/api-keys).
All three values must belong to the same project.

* `SUPABASE_URL` is the project URL.
* `SUPABASE_PUBLISHABLE_KEY` starts with `sb_publishable_` and is safe for browser use.
* `SUPABASE_SECRET_KEY` starts with `sb_secret_` and stays on the backend. It is not a database password.

Supabase-managed Auth email needs none of the backend email settings below.
Only when opting into the Kit's email hook, in
[Authentication → Hooks](https://supabase.com/dashboard/project/_/auth/hooks),
create a **Send Email** HTTP hook at your backend's
`/<WEBHOOK_PATH_PREFIX>/webhooks/supabase-auth-email` endpoint. Apps without a
prefix use `/webhooks/supabase-auth-email`. Copy its whole signing secret, including
`v1,whsec_`, into `SUPABASE_AUTH_EMAIL_HOOK_SECRET`.

The hook must be reachable from Supabase. For hosted development with local code,
use a reachable development endpoint or tunnel. Follow
[Auth setup](https://kit.kambium.net/docs/verify-deployment.md#configure-supabase-auth) for the final callback
URLs, and [Supabase setup](https://kit.kambium.net/docs/cloud-supabase.md) for the database schema.

:::

<span id="redis"></span>

::: details Redis connection and cache encryption

Copy your provider's native Redis URL into `REDIS_URL`, including credentials.
Use `rediss://` if TLS is required. A REST endpoint or token is not a substitute.

```text
rediss://default:<password>@<host>:<port>
```

Treat a password-bearing URL as a secret. `REDIS_CACHE_ENCRYPTION_KEY_B64`
encrypts cached data.
See [Redis recovery limits](https://kit.kambium.net/docs/configuration.md#database-access-and-recovery)
before replacing or flushing the store.

:::

<span id="stored-provider-credentials"></span>
<span id="generate-the-encryption-keys"></span>

::: details Encryption key format and manual generation

`CREDENTIAL_ENCRYPTION_KEY_B64` encrypts stored provider credentials.
`REDIS_CACHE_ENCRYPTION_KEY_B64` encrypts cached data. Each must independently
decode from base64 to exactly 32 random bytes.

Generate each key independently using
`node -p 'require("node:crypto").randomBytes(32).toString("base64")'` and
save the value in your environment's secret store.

Use separate keys for development and production. Replacing the credential key
without a migration prevents existing credentials from being decrypted;
replacing the cache key invalidates encrypted cache entries.

:::

<span id="postmark"></span>

For `POSTMARK_SERVER_TOKEN` and `POSTMARK_FROM_EMAIL`, follow the
[Postmark setup guide](https://kit.kambium.net/docs/cloud-postmark.md). It covers the shared backend connection
for application emails and the optional Supabase Auth hook, plus direct SMTP as
an alternative for sign-in email.

<span id="required-settings"></span>

::: details All variable names and configuration without Desktop

Use these names in the selected Fly environment.

| Service | Variable | Value |
| --- | --- | --- |
| App URLs | `API_BASE_URL` | Backend URL. |
| App URLs | `SERVE_BASE_URL` | Dashboard URL. |
| Webhooks | `WEBHOOK_PATH_PREFIX` | Required for hosted deployments of new apps. Generate 12 random bytes as 16 Base64URL characters and keep the value stable across deploys. |
| Supabase | `SUPABASE_URL` | Project URL. |
| Supabase | `SUPABASE_PUBLISHABLE_KEY` | Publishable key. |
| Supabase | `SUPABASE_SECRET_KEY` | Backend API key. |
| Supabase | `SUPABASE_AUTH_EMAIL_HOOK_SECRET` | Optional signing secret for the Kit's email hook. |
| Redis | `REDIS_URL` | Native connection URL. |
| Redis | `REDIS_CACHE_ENCRYPTION_KEY_B64` | Random 32-byte key, encoded as base64. |
| Credentials | `CREDENTIAL_ENCRYPTION_KEY_B64` | Independent random 32-byte key, encoded as base64. |
| Postmark | `POSTMARK_SERVER_TOKEN` | Optional backend email; required with the hook or sender address. |
| Postmark | `POSTMARK_FROM_EMAIL` | Verified sender for optional backend email; required with its token. |

Keep backend keys and tokens out of frontend configuration. Check that the
[Fly environment](https://kit.kambium.net/docs/setup.md) targets the same app that holds your secrets.

:::

<span id="optional-groups"></span>

The [Fly TOML file](https://kit.kambium.net/docs/cloud-fly.md) identifies the app that Desktop configures.
[Sentry](https://kit.kambium.net/docs/cloud-sentry.md) reporting and monitoring are optional.

<span id="next-steps"></span>

Once configured, [deploy the app](https://kit.kambium.net/docs/deployment.md). For local code that uses hosted
services, supply the environment's credentials through your terminal or a
gitignored `.env`. [Development with hosted services](https://kit.kambium.net/docs/local-development.md#development-with-hosted-services)
