> ## Documentation Index
> Fetch the complete documentation index at: https://bunnynet-cb9733c2-support-migration.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-support-migration/Z09ZI7FyatCuoSuT/images/database/connect/generate-tokens.png?fit=max&auto=format&n=Z09ZI7FyatCuoSuT&q=85&s=68d4bdc9c3e1bcbfd0b17665723bfdb5" 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-support-migration/Z09ZI7FyatCuoSuT/images/database/connect/magic-containers/add-secrets-to-magic-container-app.png?fit=max&auto=format&n=Z09ZI7FyatCuoSuT&q=85&s=e8feb9bf86c0b20021c331da2bd5d642"
        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-support-migration/Z09ZI7FyatCuoSuT/images/database/connect/magic-containers/select-app.png?fit=max&auto=format&n=Z09ZI7FyatCuoSuT&q=85&s=fe04af528f544637a0d3c20c23830726" 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>
