# Secrets





<DocImage src="features/secrets/environment-variables" alt="Environment Variables panel listing variable names with masked values, show and delete buttons" width="1280" height="724" />

Environment variables are key-value settings your app reads at runtime instead of having them hard-coded in source code. Use them for API keys, database credentials, and any configuration that changes between environments.

## Why Use Environment Variables? [#why-use-environment-variables]

<Cards>
  <Card title="Security" icon="<IoShield />" description="Keep secrets out of source code and version control — they're never committed to GitHub." />

  <Card title="Portability" icon="<FaToiletsPortable />" description="The same codebase runs across dev, staging, and production with different settings." />

  <Card title="Configurability" icon="<RiSettings3Fill />" description="Change app behavior — toggle features, swap services — without redeploying code." />
</Cards>

## Managing Secrets [#managing-secrets]

### Adding a Variable [#adding-a-variable]

<Steps>
  <Step>
    Open the 

    **Secrets**

     tab in your project.
  </Step>

  <Step>
    Click 

    **Add Variable**

    .
  </Step>

  <Step>
    Enter a 

    **key**

     (e.g. 

    `DATABASE_URL`

    ) and its 

    **value**

    .
  </Step>

  <Step>
    Click **Save** — the variable is injected into your sandbox immediately.
  </Step>
</Steps>

### Editing & Deleting [#editing--deleting]

Click any existing variable to edit its value inline. To delete, click the **trash icon** next to the variable. Changes take effect immediately without restarting the sandbox.

## Accessing Variables in Code [#accessing-variables-in-code]

Variables are injected into the runtime environment and accessible through your framework's standard mechanism.

```js
// Node.js / Express
const apiKey = process.env.API_KEY;
```

```js
// Vite: VITE_ variables are public, so keep private keys in server-side code
const apiUrl = import.meta.env.VITE_API_URL;
```

<Callout type="warn">
  Never paste secrets directly into the AI chat. The chat is part of your
  project context and is not a secure store for credentials.
</Callout>

## Security [#security]

All variables are encrypted at rest and masked by default in the Secrets panel. Click the **eye icon** next to any variable to reveal its value — useful for verification, and easy to hide again before screen sharing.

<Callout type="info">
  Secrets are never written to your source code or pushed to GitHub. They exist
  only in the Ideavo runtime environment.
</Callout>

These are your development values. Your live app reads its own values from Vercel or Railway. See [Production Environment](/docs/features/production-environment).

### FAQ [#faq]

<Accordions>
  <Accordion title="Can collaborators see my secret values?">
    Collaborators with Editor access or above can view and manage secrets in the
    panel. Values are masked by default — they must actively click the eye icon
    to reveal a value. Viewers have no access to the Secrets tab.
  </Accordion>

  <Accordion title="Are secrets included when I push code to GitHub?">
    No. Secrets are stored in Ideavo's runtime environment and are never written
    to your source code or committed to your repository.
  </Accordion>

  <Accordion title="Do I need to restart the sandbox after adding a variable?">
    No. Variables are injected immediately after saving. If your app caches
    environment variables on startup, you may need to restart the dev server for
    changes to take effect.
  </Accordion>

  <Accordion title="What naming conventions should I follow?">
    Use uppercase with underscores (e.g. `API_KEY`, `DATABASE_URL`). For Vite
    projects, prefix client-side variables with `VITE_` — only prefixed
    variables are exposed to the browser bundle.
  </Accordion>
</Accordions>
