Skip to content

Switching adapters

An adapter connects your app to a host. Your handlers stay the same on every host. Only discord0.config.ts changes.

Adapter Host init --adapter
@discord0/adapter-cloudflare Cloudflare Workers cloudflare (default)
@discord0/adapter-vercel Vercel Functions vercel
@discord0/adapter-netlify Netlify Functions netlify
@discord0/adapter-aws AWS Lambda with a Function URL aws
@discord0/adapter-node A Node.js server you run yourself node
@discord0/adapter-bun A Bun.serve server you run yourself bun
  1. Install the new adapter as a dev dependency:

    Terminal window
    npm install -D @discord0/adapter-vercel
  2. Import it in discord0.config.ts instead of the old one:

    discord0.config.ts
    import adapter from "@discord0/adapter-vercel";
    import { defineConfig } from "discord0";
    export default defineConfig({
    adapter: adapter(),
    guild: process.env.DISCORD_GUILD_ID,
    });
  3. Remove the old adapter if you no longer need it:

    Terminal window
    npm uninstall @discord0/adapter-cloudflare
  4. Set your credentials with the new provider, deploy, and update the Interactions Endpoint URL in the Developer Portal. If the app handles webhook events, update the Webhook Events URL too. Deploy covers each host.

If your handlers run for more than a few seconds, check the new host’s deferred-work limit before you switch.

To try a host without changing the config, pass its name to deploy:

Terminal window
npm install -D @discord0/adapter-netlify
npx discord0 deploy netlify

deploy <name> loads @discord0/adapter-<name> from your project’s node_modules, so install the adapter first.