> ## Documentation Index
> Fetch the complete documentation index at: https://bunnynet-cb9733c2-sandbox.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Bunny Magic Containers

> Connect your Magic Container apps to Bunny Database using environment variables

You can connect [Magic Container](/magic-containers) apps to your database by adding credentials as environment variables directly from the database dashboard.

<Steps>
  <Step title="Go to the Access page">
    Navigate to **Dashboard > Edge Platform > Database > \[Select Database] > Access**.
  </Step>

  <Step title="Generate tokens">
    Click **Generate Tokens** to create new access credentials for your database.

    <Frame>
      <img src="https://mintcdn.com/bunnynet-cb9733c2-sandbox/XWs4MMypnANgPaMO/images/database/connect/generate-tokens.png?fit=max&auto=format&n=XWs4MMypnANgPaMO&q=85&s=2b8cf853082a56fe8f54178698ef4add" alt="Generate Tokens" width="770" height="508" data-path="images/database/connect/generate-tokens.png" />
    </Frame>
  </Step>

  <Step title="Add to Magic Container">
    Once the tokens are generated, click **Add Secrets to Magic Container App**.

    <Frame>
      <img
        src="https://mintcdn.com/bunnynet-cb9733c2-sandbox/XWs4MMypnANgPaMO/images/database/connect/magic-containers/add-secrets-to-magic-container-app.png?fit=max&auto=format&n=XWs4MMypnANgPaMO&q=85&s=cbd1ceff9e3d5969f0ee64bdc59b826f"
        alt="Add to Magic
Container"
        width="900"
        height="538"
        data-path="images/database/connect/magic-containers/add-secrets-to-magic-container-app.png"
      />
    </Frame>
  </Step>

  <Step title="Select your app">
    Choose the Magic Container app you want to connect to your database.

    <Frame>
      <img src="https://mintcdn.com/bunnynet-cb9733c2-sandbox/XWs4MMypnANgPaMO/images/database/connect/magic-containers/select-app.png?fit=max&auto=format&n=XWs4MMypnANgPaMO&q=85&s=d23960f76c229160e0ba67df278d48ed" alt="Select App" width="876" height="666" data-path="images/database/connect/magic-containers/select-app.png" />
    </Frame>
  </Step>

  <Step title="Access the environment variables">
    The database URL and access token are now available as environment variables in your app. Use them to connect to your database:

    ```typescript theme={null}
    import { createClient } from "@libsql/client/web";

    const client = createClient({
      url: process.env.BUNNY_DATABASE_URL,
      authToken: process.env.BUNNY_DATABASE_AUTH_TOKEN,
    });

    const result = await client.execute("SELECT * FROM users");
    ```
  </Step>
</Steps>
