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/fedifyConfigure 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 deployOn the first deployment,
deployctlwill:- 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.tsSet up your custom domain in the Deno Deploy dashboard (optional)
Environment variables
You can set environment variables in multiple ways:
During deployment using the
--envflag:shdeployctl deploy --env=SERVER_NAME=mybot.deno.devUsing an environment file:
shdeployctl deploy --env-file=.envOr 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