Documentation Index
Fetch the complete documentation index at: https://docs.bunny.net/llms.txt
Use this file to discover all available pages before exploring further.
You can connect Magic Container apps to your database by adding credentials as environment variables directly from the database dashboard.
Go to the Access page
Navigate to Dashboard > Edge Platform > Database > [Select Database] > Access.
Generate tokens
Click Generate Tokens to create new access credentials for your database. Add to Magic Container
Once the tokens are generated, click Add Secrets to Magic Container App. Select your app
Choose the Magic Container app you want to connect to your database. 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: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");