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 Edge Scripts 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 script
Once the tokens are generated, click Add Secrets to Edge Script. Select your script
Choose the Edge Script 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 script. Use them to connect to your database:import { createClient } from "@libsql/client/web";
import process from "node:process";
const client = createClient({
url: process.env.BUNNY_DATABASE_URL,
authToken: process.env.BUNNY_DATABASE_AUTH_TOKEN,
});
const result = await client.execute("SELECT * FROM users");