Deno Deploy
Deno Deploy is a serverless hosting platform for Deno applications. It allows you to deploy your bot without managing servers or infrastructure. This guide shows you how to deploy your BotKit bot to Deno Deploy.
Prerequisites
Install the Deno CLI if you haven't already
- sh
deno install -gArf jsr:@deno/deployctl
Install the Fedify package to your bot project:
shdeno add jsr:@fedify/fedify
Configure your bot to use Deno KV for storage and message queue:
typescriptimport { createBot } from "@fedify/botkit"; import { DenoKvMessageQueue, DenoKvStore } from "@fedify/fedify/x/deno"; const kv = await Deno.openKv(); const bot = createBot<void>({ username: "mybot", kv: new DenoKvStore(kv), queue: new DenoKvMessageQueue(kv), // ... other configuration });
Deploying your bot
Navigate to your project directory
Deploy your bot:
shdeployctl deploy
On the first deployment,
deployctl
will:- Guess the project name from your Git repo or directory name
- Create the project automatically if it doesn't exist
- Look for common entrypoint files like main.ts or src/main.ts
You can also specify these explicitly:
shdeployctl deploy --project=mybot --entrypoint=bot.ts
Set up your custom domain in the Deno Deploy dashboard (optional)
Environment variables
You can set environment variables in multiple ways:
During deployment using the
--env
flag:shdeployctl deploy --env=SERVER_NAME=mybot.deno.dev
Using an environment file:
shdeployctl deploy --env-file=.env
Or configure them in the Deno Deploy dashboard for project-wide settings
Common variables include:
SERVER_NAME
: Your bot's domain (e.g.,mybot.deno.dev
)- Other bot-specific configuration variables