### Generate Database Quickstart Guide Source: https://github.com/bunnyway/cli/blob/main/packages/cli/README.md Generates a quickstart guide for connecting to a database. Can specify a target database ID and the desired language for the guide (e.g., `bun`). ```bash bunny db quickstart ``` ```bash bunny db quickstart --lang bun ``` -------------------------------- ### Connect to Database with Quick Start Example Source: https://github.com/bunnyway/cli/blob/main/packages/database-shell/README.md Connect to a libSQL database using the `bsql` command with your database URL and authentication token. Replace placeholders with your actual credentials. ```bash bsql libsql://.lite.bunnydb.net --token ey... ``` -------------------------------- ### Run bunny db quickstart Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/database.md Generates language-specific getting-started guides. Use the --lang flag to specify the desired language. The command can also be run interactively to select the language. ```bash bunny db quickstart ``` ```bash bunny db quickstart --lang typescript ``` ```bash bunny db quickstart --lang go ``` ```bash bunny db quickstart --lang rust ``` ```bash bunny db quickstart --lang dotnet ``` -------------------------------- ### Run Development Example Server Source: https://github.com/bunnyway/cli/blob/main/packages/database-rest/README.md Start a local development server for testing and hacking. It uses an in-memory SQLite database and does not require authentication. ```bash bun run example # or: PORT=3000 bun run example ``` -------------------------------- ### Install @bunny.net/database-adapter-libsql Source: https://github.com/bunnyway/cli/blob/main/packages/database-adapter-libsql/README.md Install the package using Bun. ```bash bun add @bunny.net/database-adapter-libsql ``` -------------------------------- ### Initialize Project Interactively Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/scripts.md Start an interactive wizard to scaffold a new Edge Script project. This command guides you through the setup process. ```bash bunny scripts init ``` -------------------------------- ### Install @bunny.net/app-config Source: https://github.com/bunnyway/cli/blob/main/packages/app-config/README.md Install the package using bun. ```bash bun add @bunny.net/app-config ``` -------------------------------- ### Install OpenAPI Client Source: https://github.com/bunnyway/cli/blob/main/packages/openapi-client/README.md Install the @bunny.net/openapi-client package using Bun. ```bash bun add @bunny.net/openapi-client ``` -------------------------------- ### Install @bunny.net/cli Source: https://github.com/bunnyway/cli/blob/main/packages/cli/README.md Install the CLI using the provided shell script or npm. The shell installer downloads a prebuilt binary. ```bash curl -fsSL https://cli.bunny.net/install.sh | sh ``` ```bash npm install -g @bunny.net/cli ``` -------------------------------- ### Install @bunny.net/sandbox Source: https://github.com/bunnyway/cli/blob/main/packages/sandbox/README.md Install the sandbox package using Bun. ```bash bun add @bunny.net/sandbox ``` -------------------------------- ### Bunny.net CLI Examples: Login and Database Source: https://github.com/bunnyway/cli/blob/main/README.md Examples of using the bunny.net CLI for logging in and listing databases. ```bash bun ny login bun ny db list ``` -------------------------------- ### Install Bunny.net CLI via Bun Source: https://github.com/bunnyway/cli/blob/main/README.md Install the bunny.net CLI globally using Bun. ```bash bun install -g @bunny.net/cli ``` -------------------------------- ### Quick Start: Create and Secure REST Handler Source: https://github.com/bunnyway/cli/blob/main/packages/database-rest/README.md Set up a REST API handler for a LibSQL database using @bunny.net/database-rest. This example demonstrates creating the handler, introspecting the schema, and securing it with a shared token using requireAuth(). Remember to always wrap the handler in an authentication check before network exposure. ```typescript import { createClient } from "@libsql/client"; import { createLibSQLExecutor, introspect } from "@bunny.net/database-adapter-libsql"; import { createRestHandler, requireAuth } from "@bunny.net/database-rest"; const client = createClient({ url: ":memory:" }); await client.executeMultiple(" CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT NOT NULL, email TEXT NOT NULL); INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com'); "); const schema = await introspect({ client }); const executor = createLibSQLExecutor({ client }); const handler = createRestHandler(executor, schema); const token = process.env.API_TOKEN ?? crypto.randomUUID(); const guarded = requireAuth(handler, { token }); Bun.serve({ port: 8080, hostname: "127.0.0.1", fetch: guarded, }); ``` -------------------------------- ### Quick Start with @bunny.net/cli Source: https://github.com/bunnyway/cli/blob/main/packages/cli/README.md Authenticate with your bunny.net account or set up a profile with an API key. Then, list or create databases. ```bash # Authenticate with your bunny.net account bunny login # Or set up a profile with an API key directly bunny config init --api-key bny_xxxxxxxxxxxx # List your databases bunny db list # Create a new database bunny db create ``` -------------------------------- ### Install Database REST Package Source: https://github.com/bunnyway/cli/blob/main/packages/database-rest/README.md Install the @bunny.net/database-rest package using Bun. ```bash bun add @bunny.net/database-rest ``` -------------------------------- ### Install Database OpenAPI Generator Source: https://github.com/bunnyway/cli/blob/main/packages/database-openapi/README.md Install the package using Bun. ```bash bun add @bunny.net/database-openapi ``` -------------------------------- ### Install Bunny.net CLI via npm Source: https://github.com/bunnyway/cli/blob/main/README.md Install the bunny.net CLI globally using npm. ```bash npm install -g @bunny.net/cli ``` -------------------------------- ### Quick Start: Create and Use a Sandbox Source: https://github.com/bunnyway/cli/blob/main/packages/sandbox/README.md Demonstrates the basic workflow of creating a sandbox, writing files, running a command, exposing a port, and deleting the sandbox. ```typescript import { Sandbox } from "@bunny.net/sandbox"; // Provision a sandbox and wait until it accepts connections. const sandbox = await Sandbox.create({ apiKey: process.env.BUNNYNET_API_KEY, name: "my-sandbox", region: "AMS", }); // Buffer a file into the sandbox. await sandbox.writeFiles([{ path: "server.js", content: Buffer.from("console.log('hi')") }]); // Run a command and read the result. const result = await sandbox.runCommand("node", ["--version"]); console.log(result.exitCode, await result.stdout()); // Expose a port as a public CDN URL. const url = await sandbox.exposePort(3000); console.log(url); await sandbox.delete(); ``` -------------------------------- ### Scaffold and Deploy Scriptable DNS Script Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/dns.md Initializes a new Scriptable DNS script project, scaffolds it with example files, and deploys it. Use `--example` to specify a template. ```bash bunny dns scripts init geo-router --example geo --deploy ``` -------------------------------- ### Deploying Apps with Bunny CLI Source: https://github.com/bunnyway/cli/blob/main/packages/cli/src/commands/apps/APPS.md Examples of deploying apps using pre-built images, building from a Dockerfile, or re-deploying existing configurations. ```bash bunny apps deploy ghcr.io/myorg/api:v1.2 ``` ```bash bunny apps deploy --dockerfile ``` ```bash bunny apps deploy ``` -------------------------------- ### Install Database Shell Source: https://github.com/bunnyway/cli/blob/main/packages/database-shell/README.md Install the database-shell package using npm. ```bash npm add @bunny.net/database-shell ``` -------------------------------- ### Install Monorepo Dependencies Source: https://github.com/bunnyway/cli/blob/main/README.md Install all necessary dependencies for the monorepo using Bun. ```bash bun install ``` -------------------------------- ### Basic Usage with libSQL Source: https://github.com/bunnyway/cli/blob/main/packages/database-adapter-libsql/README.md Set up a libSQL client, introspect the schema, create an executor, and start a REST handler. ```typescript import { createClient } from "@libsql/client"; import { createLibSQLExecutor, introspect } from "@bunny.net/database-adapter-libsql"; import { createRestHandler } from "@bunny.net/database-rest"; const client = createClient({ url: "libsql://your-db.lite.bunnydb.net", authToken: "your-token", }); const schema = await introspect({ client }); const executor = createLibSQLExecutor({ client }); const handler = createRestHandler(executor, schema); Bun.serve({ port: 8080, fetch: handler }); ``` -------------------------------- ### Bunny.net CLI Examples: Deploying Applications Source: https://github.com/bunnyway/cli/blob/main/README.md Demonstrates deploying applications using the bunny.net CLI, including deploying pre-built images, building from Dockerfile, and handling different deployment scenarios. ```bash bun ny apps deploy ghcr.io/me/api:v1.2 # deploy a pre-built image bun ny apps deploy --dockerfile # build ./Dockerfile and deploy bun ny apps deploy # first run? Imports docker-compose.yml if present; otherwise auto-detects Dockerfile(s) (including monorepo subdirs) so you can pick one or many, or falls back to a pre-built image. ``` -------------------------------- ### Manage CLI Configuration and Profiles Source: https://github.com/bunnyway/cli/blob/main/packages/cli/README.md Initialize configuration, view settings, and manage named profiles. Use `--api-key` for non-interactive setup. ```bash # First-time setup bunny config init bunny config init --api-key bny_xxxxxxxxxxxx # View resolved configuration bunny config show bunny config show --output json # Manage named profiles bunny config profile create staging bunny config profile create staging --api-key bny_xxxxxxxxxxxx bunny config profile delete staging ``` -------------------------------- ### Initialize Edge Script Project Source: https://github.com/bunnyway/cli/blob/main/packages/cli/README.md Scaffold a new Edge Script project from a template. Use interactive mode for a guided setup or non-interactive flags for specific configurations. Custom template repositories can be specified using GitHub shorthand or full Git URLs. ```bash bunny scripts init ``` ```bash bunny scripts init --name my-script --type standalone --template Empty --no-github-actions --deploy ``` ```bash bunny scripts init --name my-script --type standalone --template Empty --github-actions --deploy ``` ```bash bunny scripts init --repo owner/my-template ``` ```bash bunny scripts init --template-repo https://github.com/owner/my-template ``` -------------------------------- ### Install Bunny.net CLI via Shell Script Source: https://github.com/bunnyway/cli/blob/main/README.md Use this command to download and install the prebuilt binary of the bunny.net CLI using a shell script. ```bash curl -fsSL https://cli.bunny.net/install.sh | sh ``` -------------------------------- ### Start Interactive Shell Source: https://github.com/bunnyway/cli/blob/main/packages/database-shell/README.md Initialize and start an interactive database shell session using a provided libsql client. ```typescript import { createClient } from "@libsql/client"; import { startShell } from "@bunny.net/database-shell"; const client = createClient({ url: "libsql://...", authToken: "...", }); await startShell({ client }); ``` -------------------------------- ### Example bunny.jsonc Configuration Source: https://github.com/bunnyway/cli/blob/main/packages/app-config/README.md An example of a bunny.jsonc file, demonstrating app name, scaling, regions, and container configurations. The $schema property enables editor autocompletion and validation. ```jsonc { "$schema": "./node_modules/@bunny.net/app-config/generated/schema.json", "app": { "name": "my-app", "scaling": { "min": 1, "max": 3 }, "regions": { "allowed": ["EU-West", "US-East"], "required": ["EU-West"], }, "containers": { "web": { "image": "nginx:latest", "endpoints": [ { "type": "cdn", "ssl": true, "ports": [{ "public": 80, "container": 8080 }], }, ], }, }, }, } ``` -------------------------------- ### Bunny.net CLI Examples: Linking Applications Source: https://github.com/bunnyway/cli/blob/main/README.md Examples for linking and unlinking applications with the bunny.net CLI. This includes interactive selection and linking specific app IDs. ```bash bun ny apps link # interactive: pick from existing apps on the account bun ny apps link # link a specific app to this directory (writes .bunny/app.json) bun ny apps unlink # remove .bunny/app.json ``` -------------------------------- ### Core Client Usage Example Source: https://github.com/bunnyway/cli/blob/main/packages/openapi-client/README.md Demonstrates how to create and use the core client to fetch data, specifically listing pull zones. ```APIDOC ## createCoreClient ### Description Creates an instance of the core API client for interacting with bunny.net's primary services. ### Method `createCoreClient(options: ClientOptions)` ### Parameters #### Options Object - **apiKey** (string) - Required - Your bunny.net API key. - **baseUrl** (string) - Optional - The base URL for the API. Defaults to `https://api.bunny.net`. - **verbose** (boolean) - Optional - Enables verbose logging. - **userAgent** (string) - Optional - Custom user agent string. - **onDebug** (function) - Optional - Callback for debug messages. ### Request Example ```typescript import { createCoreClient } from "@bunny.net/openapi-client"; const client = createCoreClient({ apiKey: "bny_xxxxxxxxxxxx", }); const { data } = await client.GET("/pullzone"); console.log(data?.Items); ``` ### Response #### Success Response (200) - **data** (object) - Contains the response payload, typically with an `Items` array for collections. #### Response Example ```json { "Items": [ { "ID": 123, "Name": "Example Pullzone" }, // ... other pull zones ] } ``` ``` -------------------------------- ### Install Database Shell Globally Source: https://github.com/bunnyway/cli/blob/main/packages/database-shell/README.md Install the database shell globally using npm. This command makes the `bsql` executable available on your system. ```bash npm install -g @bunny.net/database-shell ``` -------------------------------- ### Initialize Scriptable DNS Project Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/dns.md Scaffold a new scriptable DNS project with necessary files like the entry point, tsconfig, and package.json. Use `--example` to choose a starter template and `--deploy` to create the script on bunny.net immediately. ```bash bunny dns scripts init # interactive wizard ``` ```bash bunny dns scripts init geo-router --example geo --deploy ``` -------------------------------- ### Rollback Command Example Source: https://github.com/bunnyway/cli/blob/main/packages/cli/src/commands/apps/APPS.md An example of a rollback command provided by the CLI after a successful deployment that replaced a running image. ```bash bunny apps deploy ghcr.io/me/api:abc-123 ``` -------------------------------- ### Create Core Client for API Calls Source: https://github.com/bunnyway/cli/blob/main/AGENTS.md Example of initializing the core client with resolved configuration for making API requests. Ensure configuration and client options are correctly set up. ```typescript import { createCoreClient } from "@bunny.net/openapi-client"; import { resolveConfig } from "../../config/index.ts"; import { clientOptions } from "../../core/client-options.ts"; handler: async ({ profile, apiKey, verbose }) => { const config = resolveConfig(profile, apiKey, verbose); const api = createCoreClient(clientOptions(config, verbose)); const { data, error } = await api.GET("/pullzone/{id}", { params: { path: { id: 12345 } }, }); }; ``` -------------------------------- ### Example Plugin Configuration Source: https://github.com/bunnyway/cli/blob/main/AGENTS.md Shows how to list plugins in the user's config file. Plugins are npm packages that export yargs CommandModule objects. ```json { "profiles": { ... }, "plugins": [ "bunny-cli-plugin-analytics", "@acme/bunny-cli-plugin-deploy" ] } ``` -------------------------------- ### Create Database JSON Output Example Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/database.md Example JSON output when creating a database in non-interactive mode with `--output json`. Includes fields like `db_id`, `url`, `linked`, `token`, and `saved_to_env`. ```json { "db_id": "db_01KCHBG8C5KSFGG0VRNFQ7EK7X", "name": "my-app", "url": "libsql://...bunnydb.net/", "linked": true, "token": "ey...", "saved_to_env": true } ``` -------------------------------- ### Bunny CLI Configuration File Example Source: https://github.com/bunnyway/cli/blob/main/AGENTS.md A JSON file storing profiles and settings, matching the Go CLI format for backward compatibility. It includes log level and multiple profiles with API keys and URLs. ```json { "log_level": "info", "profiles": { "default": { "api_key": "bny_xxxxxxxxxxxx", "api_url": "https://api.bunny.net" }, "staging": { "api_key": "bny_test_xxxxxxx", "api_url": "https://staging-api.bunny.net" } } } ``` -------------------------------- ### Create a DNS Zone Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/api.md Example of creating a new DNS zone by sending a JSON body with the `--body` flag. ```bash bunny api POST /dnszone --body '{"Domain":"example.com"}' ``` -------------------------------- ### List All Pull Zones Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/api.md Example of listing all available pull zones using the `bunny api` command. ```bash bunny api GET /pullzone ``` -------------------------------- ### Start Interactive SQL Shell Source: https://github.com/bunnyway/cli/blob/main/packages/database-shell/README.md Launch the interactive SQL shell by providing the database URL and an optional authentication token. This opens a REPL for executing SQL commands. ```bash bsql [--token ] ``` -------------------------------- ### Initialize a new Bunny App Source: https://github.com/bunnyway/cli/blob/main/packages/cli/src/commands/apps/APPS.md Scaffold a new bunny.jsonc configuration file for an application. This command initiates a walkthrough for project setup, including options for image references, Dockerfiles, and port configurations. It stops after writing the config, allowing for manual edits before deployment. ```bash bunny apps init ``` ```bash bunny apps init ghcr.io/me/api:v1 ``` ```bash bunny apps init --dockerfile --port 8080 ``` -------------------------------- ### Bunny.net CLI Examples: DNS Management Source: https://github.com/bunnyway/cli/blob/main/README.md Illustrates various DNS management tasks using the bunny.net CLI, such as adding zones, checking nameservers, scanning records, and applying presets. ```bash bun ny dns zones add example.com # create a zone; auto-scans for existing records, then offers to import/upload/add before registrar setup steps bun ny dns zones nameservers example.com # live-check whether the registrar delegates to bunny bun ny dns records scan example.com # scan for the domain's existing records and import them bun ny dns records preset list # list DNS record presets (email providers, verification, security) bun ny dns records preset google-workspace example.com # apply a preset record set bun ny dns records preset bluesky example.com --param did=did:plc:abc123 # apply a preset non-interactively ``` -------------------------------- ### Bunny CLI Plugin Management Commands Source: https://github.com/bunnyway/cli/blob/main/AGENTS.md These are example commands for managing plugins within the Bunny CLI. They allow listing, adding, and removing plugins. ```bash bunny plugins list # Show installed plugins bunny plugins add # Install + register in config bunny plugins remove # Unregister + uninstall ``` -------------------------------- ### Multi-container app configuration Source: https://github.com/bunnyway/cli/blob/main/packages/cli/src/commands/apps/APPS.md Example `bunny.jsonc` configuration for a multi-container application. Each container is defined as a separate entry under `app.containers`. ```jsonc { "version": "2026-05-11", "app": { "name": "my-stack", "regions": ["sfo"], "containers": { "api": { "image": "ghcr.io/me/api:v1", "registry": "12345", "env": { "DB_URL": "postgres://db:5432/app" }, }, "db": { "image": "postgres:16", "env": { "POSTGRES_PASSWORD": "..." }, }, }, }, } ``` -------------------------------- ### Create and Use Core Client Source: https://github.com/bunnyway/cli/blob/main/packages/openapi-client/README.md Instantiate the core client with an API key and make a GET request to the /pullzone endpoint. Logs the 'Items' from the response data. ```typescript import { createCoreClient } from "@bunny.net/openapi-client"; const client = createCoreClient({ apiKey: "bny_xxxxxxxxxxxx", }); const { data } = await client.GET("/pullzone"); console.log(data?.Items); ``` -------------------------------- ### Single-container app configuration Source: https://github.com/bunnyway/cli/blob/main/packages/cli/src/commands/apps/APPS.md Example `bunny.jsonc` configuration for a single-container application. It includes settings for image, environment variables, and endpoints. ```jsonc { "$schema": "./node_modules/@bunny.net/app-config/generated/schema.json", "version": "2026-05-11", "app": { "id": "app_xxx", // written by the CLI on first deploy "name": "my-api", "regions": ["sfo", "lhr"], // simple array "scaling": { "min": 1, "max": 3 }, "containers": { "api": { "image": "ghcr.io/me/api:v1", // last deployed; rewritten each deploy "registry": "12345", // bunny registry id "dockerfile": "Dockerfile", // optional — enables the build path "context": ".", // optional — Docker build context "env": { "PORT": "3000" }, "endpoints": [ { "type": "cdn", "ssl": true, "ports": [{ "public": 443, "container": 3000 }] }, ], }, }, }, } ``` -------------------------------- ### Starting Shell with Database ID Source: https://github.com/bunnyway/cli/blob/main/packages/database-shell/README.md Configure the database shell to use views by passing a `databaseId` during initialization. This ensures views are correctly scoped. ```typescript await startShell({ client, databaseId: "db_01ABC", }); ``` -------------------------------- ### List, Show, and Get Nameservers for DNS Zones Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/dns.md Commands to manage DNS zone information. 'list' shows all zones, 'show' displays zone details, and 'nameservers' checks live delegation. Aliases 'ls' and 'ns' are available. ```bash bunny dns zones list # all zones (alias: ls) ``` ```bash bunny dns zones show example.com # zone details ``` ```bash bunny dns zones nameservers example.com # check delegation (alias: ns) ``` -------------------------------- ### Create a new database Source: https://github.com/bunnyway/cli/blob/main/packages/cli/README.md Create a new database with interactive prompts for name and region, or specify them via flags. Supports multi-region setups and non-interactive creation for CI/scripts. ```bash # Interactive — prompts for name and region mode bunny db create # Single region bunny db create --name mydb --primary FR # Multi-region with replicas bunny db create --name mydb --primary FR,DE --replicas UK,NY # Fully non-interactive (CI / scripts) bunny db create --name mydb --primary FR --link --token --save-env --output json ``` -------------------------------- ### bunny sandbox create Source: https://github.com/bunnyway/cli/blob/main/packages/cli/README.md Creates and starts a new on-demand cloud sandbox environment. The command waits for the container's SSH port to become reachable before returning. Users can specify a name for the sandbox and the deployment region. ```APIDOC ## `bunny sandbox create` ### Description Create and start a new sandbox. Waits for the container's SSH port to become reachable before returning. ### Usage ```bash # Create a sandbox with the default name "sandbox" bunny sandbox create # Create a named sandbox bunny sandbox create my-sandbox # Create in a specific region bunny sandbox create my-sandbox --region NY ``` ### Parameters #### Query Parameters - `--region` (string) - Optional - Region ID to deploy in (e.g. `AMS`, `NY`, `LA`, …). Defaults to `AMS`. ### Response Once ready, the output shows the app ID, public HTTPS hostname, and SSH address. ``` -------------------------------- ### Apply DNS Record Presets Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/dns.md Apply curated sets of DNS records for common providers or tasks. This command can list available presets, apply a specific named preset, or run interactively. Use the `--output json` flag to get preset information in JSON format. ```bash bunny dns records preset # pick a preset interactively ``` ```bash bunny dns records preset list # list available presets ``` ```bash bunny dns records preset google-workspace example.com # apply a named preset ``` ```bash bunny dns records preset list --output json ``` -------------------------------- ### Apply a Preset Record Set Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/dns.md Applies a predefined set of DNS records for common services like Google Workspace. Use this for quick setup of essential records. ```bash bunny dns records preset google-workspace example.com ``` -------------------------------- ### Handle JSON and Formatted Output in Commands Source: https://github.com/bunnyway/cli/blob/main/AGENTS.md Example of how to handle different output formats within a command handler. It logs raw JSON to stdout for '--output json' or uses formatting functions for other formats. ```typescript import { formatTable, formatKeyValue } from "../../core/format.ts"; handler: async ({ output, profile, apiKey }) => { const result = await fetchSomething(); if (output === "json") { logger.log(JSON.stringify(result)); return; } // Tabular data — formatTable handles text, table, csv, markdown logger.log(formatTable(["Name", "Status"], rows, output)); // Key-value data — formatKeyValue renders as a 2-column table logger.log(formatKeyValue([{ key: "Name", value: "Alice" }], output)); }; ``` -------------------------------- ### New Project from Scratch Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/scripts.md Scaffold a new project, create a remote script, and deploy it. Use `--no-github-actions` to exclude GitHub Actions workflows. ```bash bunny scripts init --name my-script --type standalone --template Empty --no-github-actions --deploy cd my-script bunny scripts deploy dist/index.js ``` -------------------------------- ### Generate and Use Config File in CI Source: https://github.com/bunnyway/cli/blob/main/packages/cli/src/commands/apps/APPS.md Demonstrates generating a configuration file at runtime using shell commands and then deploying with it. ```bash echo "$CONFIG_JSON" > /tmp/agent-task.jsonc bunny apps deploy --config /tmp/agent-task.jsonc --output json # ... do work via Tailscale / your container's own endpoints ... # Clean up bunny apps delete --force --id $(jq -r .app.id /tmp/agent-task.jsonc) rm /tmp/agent-task.jsonc ``` -------------------------------- ### Starting Shell with Custom Views Directory Source: https://github.com/bunnyway/cli/blob/main/packages/database-shell/README.md Override the default storage directory for saved views by specifying a custom `viewsDir` path when starting the shell. ```typescript await startShell({ client, viewsDir: "/path/to/my/views", }); ``` -------------------------------- ### Build and Deploy from Dockerfile Source: https://github.com/bunnyway/cli/blob/main/packages/cli/src/commands/apps/APPS.md Build a Docker image from a Dockerfile in the current directory and then deploy it. Use `--dockerfile` with a path to specify a different Dockerfile. ```bash bunny apps deploy --dockerfile ``` ```bash bunny apps deploy --dockerfile apps/api/Dockerfile --context apps/api ``` -------------------------------- ### Error Response Format Source: https://github.com/bunnyway/cli/blob/main/packages/database-rest/README.md Example JSON structure for an error response. ```json { "message": "Row not found", "code": "NOT_FOUND" } ``` -------------------------------- ### Initialize Project with Options Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/scripts.md Scaffold a new Edge Script project with specific configurations, including name, type, template, and deployment options. Use `--no-github-actions` to omit GitHub Actions. ```bash bunny scripts init --name my-script --type standalone --template Empty --no-github-actions --deploy ``` -------------------------------- ### Collection Response Format Source: https://github.com/bunnyway/cli/blob/main/packages/database-rest/README.md Example JSON structure for a collection of resources. ```json { "data": [ { "id": 1, "name": "John" }, { "id": 2, "name": "Jane" } ] } ``` -------------------------------- ### Single Resource Response Format Source: https://github.com/bunnyway/cli/blob/main/packages/database-rest/README.md Example JSON structure for a single resource. ```json { "data": { "id": 1, "name": "John" } } ``` -------------------------------- ### Get Resource by ID Source: https://github.com/bunnyway/cli/blob/main/packages/database-rest/README.md Retrieve a single resource from a collection by its primary key. ```APIDOC ## Get by ID curl /users/1 curl /users/1?select=id,name Returns `404` if the row doesn't exist. ``` -------------------------------- ### Get OpenAPI Specification Source: https://github.com/bunnyway/cli/blob/main/packages/database-rest/README.md Retrieve the full OpenAPI 3.0.3 specification for the database schema. ```http GET / ``` -------------------------------- ### Get a Specific Pull Zone Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/api.md Retrieve details for a specific pull zone by providing its ID. ```bash bunny api GET /pullzone/12345 ``` -------------------------------- ### Initialize Project with Full Custom Template URL Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/scripts.md Scaffold a new Edge Script project using a custom template specified by its full Git repository URL. ```bash bunny scripts init --template-repo https://github.com/owner/my-template ``` -------------------------------- ### Executing SQL Queries and Files via CLI Source: https://github.com/bunnyway/cli/blob/main/AGENTS.md Demonstrates how to execute SQL queries directly or from files using the `bunny db shell` command. Supports specifying database ID and output modes. ```bash bunny db shell "SELECT * FROM users" bunny db shell db_01ABC "SELECT * FROM users" bunny db shell -e "SELECT * FROM users" -m json bunny db shell -e seed.sql bunny db shell seed.sql ``` -------------------------------- ### Get Existing Sandbox by App ID Source: https://github.com/bunnyway/cli/blob/main/packages/sandbox/README.md Retrieves an existing sandbox using its application ID, fetching its connection details from the API. ```typescript const sandbox = await Sandbox.get({ apiKey, appId }); ``` -------------------------------- ### Run bunny db studio Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/database.md Launches a local read-only table viewer. Use flags to specify the database, port, or to prevent the browser from auto-opening. Credential resolution follows a specific order: flags, .env variables, then API lookup. ```bash bunny db studio ``` ```bash bunny db studio db_01KCHBG8C5KSFGG0VRNFQ7EK7X ``` ```bash bunny db studio --port 3000 ``` ```bash bunny db studio --no-open ``` ```bash bunny db studio --url libsql://... --token ey... ``` -------------------------------- ### JSON Error Payload Example Source: https://github.com/bunnyway/cli/blob/main/AGENTS.md When using the --output json flag, error payloads include all available context for validation failures. ```json { "error": "Validation failed.", "status": 400, "field": "Name", "validationErrors": [ { "field": "Name", "message": "Name is required." } ] } ``` -------------------------------- ### List Databases Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/database.md Fetches all databases with pagination, live metrics, and region configuration. Displays ID, Name, Status, Primary Region, and Size. ```bash bunny db list # table format ``` ```bash bunny db ls # alias ``` ```bash bunny db list --output json # JSON format ``` -------------------------------- ### List All Apps Source: https://github.com/bunnyway/cli/blob/main/packages/cli/src/commands/apps/APPS.md Use `bunny apps list` to see all your applications. Use `--output json` for machine-readable output. ```bash bunny apps list bunny apps ls --output json ``` -------------------------------- ### Run Long-Running Commands with Detached Mode Source: https://github.com/bunnyway/cli/blob/main/packages/sandbox/README.md Starts a command in detached mode and streams its output. Use this for processes that need to run in the background. ```typescript const server = await sandbox.runCommand({ cmd: "node", args: ["server.js"], detached: true, }); for await (const { stream, data } of server.logs()) { process[stream].write(data); } const finished = await server.wait(); console.log(finished.exitCode); ``` -------------------------------- ### Deploy Pre-built Image Source: https://github.com/bunnyway/cli/blob/main/packages/cli/src/commands/apps/APPS.md Deploy an application using a pre-built container image. This skips the build process. ```bash bunny apps deploy ghcr.io/myorg/api:v1.2 ``` -------------------------------- ### Create a DNS Zone Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/dns.md Creates a new DNS zone and prints the nameservers to set at your registrar. Use this to initiate a new DNS zone with Bunny. ```bash bunny dns zones add example.com ``` -------------------------------- ### Example Script Manifest Format Source: https://github.com/bunnyway/cli/blob/main/AGENTS.md This JSON structure represents the manifest file for linking a directory to a remote Edge Script. It is stored in `.bunny/script.json` and is machine-managed. ```json { "id": 12345, "name": "my-script", "scriptType": 1 } ``` -------------------------------- ### Create Database (Interactive) Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/database.md Creates a new database interactively, prompting for name and region selection. Offers to link the directory, generate an auth token, and save environment variables. ```bash bunny db create # interactive mode ``` -------------------------------- ### Bun Test Example Source: https://github.com/bunnyway/cli/blob/main/CLAUDE.md A basic test case using Bun's built-in testing utilities. Ensure 'bun:test' is imported for test execution. ```typescript import { test, expect, describe } from "bun:test"; test("example", () => { expect(1).toBe(1); }); ``` -------------------------------- ### bunny sandbox ssh Source: https://github.com/bunnyway/cli/blob/main/packages/cli/README.md Opens an interactive SSH session to a specified sandbox. The session starts in the `/workplace` directory, and can be closed by typing `exit` or pressing Ctrl-D. ```APIDOC ## `bunny sandbox ssh` ### Description Open a full interactive SSH session. Drops you into a bash shell at `/workplace`. Type `exit` or press Ctrl-D to close. ### Usage ```bash bunny sandbox ssh my-sandbox ``` ### Parameters #### Path Parameters - `my-sandbox` (string) - The name of the sandbox to SSH into. ``` -------------------------------- ### Link Directory and Deploy Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/scripts.md Link an existing local directory to a remote script and then deploy your code. This is useful when you have an existing remote script. ```bash bunny scripts link bunny scripts deploy dist/index.js ``` -------------------------------- ### Open bunny.net Documentation Source: https://github.com/bunnyway/cli/blob/main/packages/cli/README.md Open the bunny.net documentation in your default browser. ```bash bunny docs ``` -------------------------------- ### Initialize Project with Custom Template Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/scripts.md Scaffold a new Edge Script project using a custom template from a Git repository. Supports shorthand GitHub owner/repo format. ```bash bunny scripts init --repo owner/my-template ``` -------------------------------- ### Get Single Resource by ID Source: https://github.com/bunnyway/cli/blob/main/packages/database-rest/README.md Retrieve a single resource from a collection using its primary key. Supports selecting specific fields. Returns 404 if the row doesn't exist. ```bash curl /users/1 ``` ```bash curl /users/1?select=id,name ``` -------------------------------- ### Initialize Project with GitHub Actions Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/scripts.md Scaffold a new Edge Script project and include GitHub Actions workflows for CI/CD. The script ID will be printed for adding as a GitHub repo secret. ```bash bunny scripts init --name my-script --type standalone --template Empty --github-actions --deploy ``` -------------------------------- ### Verify API Key with Bunny CLI Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/SKILL.md Verify the active API key by making a simple GET request to the /user endpoint. This is a recommended step when troubleshooting authentication issues. ```bash bunny api GET /user ``` -------------------------------- ### Display Database Details with Bunny CLI Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/database.md Use `bunny db show` to display database details. It can auto-detect from .env, accept an explicit ID, or output in JSON format. ```bash bunny db show # auto-detect from .env bunny db show db_01KCHBG8C5KSFGG0VRNFQ7EK7X # explicit ID bunny db show --output json ``` -------------------------------- ### Dry Run Deployment Source: https://github.com/bunnyway/cli/blob/main/packages/cli/src/commands/apps/APPS.md Simulate the deployment process and preview the resulting `bunny.jsonc` configuration without making any changes or contacting the API. ```bash bunny apps deploy --dry-run ``` -------------------------------- ### Show App Details Source: https://github.com/bunnyway/cli/blob/main/packages/cli/src/commands/apps/APPS.md Retrieve detailed information about a specific app, including its status, regions, scaling, cost, and containers. You can specify the app using `--id `. ```bash bunny apps show bunny apps show --id ``` -------------------------------- ### Existing Project Deployment Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/references/scripts.md Create a remote script for an existing project and then deploy it. This command also links the local directory to the created script. ```bash bunny scripts create # links .bunny/script.json + creates a pull zone bunny scripts deploy dist/index.js ``` -------------------------------- ### Make Raw API Requests with Bunny CLI Source: https://github.com/bunnyway/cli/blob/main/skills/bunny-cli/SKILL.md Execute raw GET requests to the bunny.net API for resources like pullzones or user information. This is useful for accessing data not directly exposed by specific CLI commands. ```bash bunny api GET /pullzone bunny api GET /user ```