> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nometria.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment Variables

> Manage secrets, API keys, and per-environment configuration.

Environment variables are how your app gets secrets (API keys, database URLs) without baking them into your source code. Nometria encrypts all variables at rest and injects them at runtime.

## Add environment variables

<Tabs>
  <Tab title="During setup">
    On the configuration screen before your first deploy, scroll to **Environment Variables** and add your key/value pairs.
  </Tab>

  <Tab title="After deploy">
    Dashboard → your project → **Settings** → **Environment Variables**.

    Add or edit variables and click **Save & Redeploy** to apply changes. Nometria triggers a zero-downtime redeploy.
  </Tab>
</Tabs>

## Common variables by framework

<AccordionGroup>
  <Accordion title="React + Vite (Supabase)">
    ```bash theme={null}
    VITE_SUPABASE_URL=https://xxxxxxxxxxxx.supabase.co
    VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
    ```

    <Warning>Vite exposes variables prefixed with `VITE_` to the browser bundle. Never put secret keys in `VITE_` variables — use them only for public anon keys or public URLs.</Warning>
  </Accordion>

  <Accordion title="Next.js (Supabase)">
    ```bash theme={null}
    # Public (exposed to browser)
    NEXT_PUBLIC_SUPABASE_URL=https://xxxxxxxxxxxx.supabase.co
    NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

    # Server-only (never sent to browser)
    SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
    ```
  </Accordion>

  <Accordion title="Stripe">
    ```bash theme={null}
    # Public key — safe to expose to browser
    NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_...

    # Secret key — server-only, never prefix with NEXT_PUBLIC_ or VITE_
    STRIPE_SECRET_KEY=sk_live_...
    STRIPE_WEBHOOK_SECRET=whsec_...
    ```
  </Accordion>

  <Accordion title="OpenAI / Anthropic">
    ```bash theme={null}
    # Server-only — never expose to browser
    OPENAI_API_KEY=sk-...
    ANTHROPIC_API_KEY=sk-ant-...
    ```
  </Accordion>
</AccordionGroup>

## Environments

Nometria supports separate variable sets for **staging** and **production**:

* **Staging** — your `*.nometria.com` URL or a `staging.yourcompany.com` subdomain
* **Production** — your primary custom domain

Variables set at the project level apply to both. Override individual variables per environment:

1. Settings → Environment Variables → toggle **Per-environment override**
2. Set the staging value and production value separately

This lets you use test Stripe keys on staging and live keys on production with zero code changes.

## Security

* All variables are **encrypted at rest** using AES-256
* Variables are **never logged** in build output or deploy logs
* Values are **masked** in the dashboard after saving (you can only overwrite, not view)
* Variables are injected as true environment variables at container startup — they are not written to disk

<Warning>Never commit secrets to your Git repository. Nometria reads secrets from the encrypted variable store, not from `.env` files in your repo.</Warning>

## Importing from .env files

If you have a local `.env` file, you can bulk-import it:

1. Settings → Environment Variables → **Import .env**
2. Paste the contents of your `.env` file
3. Review the parsed variables and click **Import**

Nometria strips any `#` comments and blank lines automatically.
