Skip to content

CIRCE / DOCUMENTATION

Deno

Run Circe on Deno 2 with tasks, scoped permissions, Docker and Deno Deploy.

Documentation menu
On this page

Project configuration

Circe runs on Deno through npm specifiers. Declare imports and tasks in deno.json:

{
  "tasks": {
    "dev": "deno run --allow-net --allow-env --allow-read --allow-write --allow-run npm:@sxnnyside/circe/cli dev",
    "start": "deno run --allow-net --allow-env --allow-read npm:@sxnnyside/circe/cli start",
    "build": "deno run --allow-net --allow-env --allow-read npm:@sxnnyside/circe/cli build",
    "doctor": "deno run --allow-net --allow-env --allow-read npm:@sxnnyside/circe/cli doctor",
    "routes": "deno run --allow-net --allow-env --allow-read npm:@sxnnyside/circe/cli routes"
  },
  "imports": {
    "@sxnnyside/circe": "npm:@sxnnyside/circe@^1.2.0",
    "@sxnnyside/circe/sqlite": "npm:@sxnnyside/circe@^1.2.0/sqlite",
    "discord.js": "npm:discord.js@^14.28.1",
    "zod": "npm:zod@^4.0.0"
  }
}

circe init --runtime deno generates this for you:

deno run -A npm:@sxnnyside/circe/cli init --runtime deno --standard
deno task doctor
deno task dev
deno task start

Permissions

Deno denies everything by default. Circe needs:

Permission Why
--allow-net Discord REST and Gateway, and the HTTP or health port.
--allow-env Reading your environment schema.
--allow-read Scanning src/ and reading .env.
--allow-write Only if you persist SQLite data; scope it, e.g. --allow-write=./data.
--allow-run circe dev only: it restarts the bot as a child process.

The scaffold’s tasks use -A for convenience; narrow them for production.

Environment file. If your variables are in .env, add --env-file=.env to the deno run flags, since Deno does not load it by itself.

HTTP interactions

With transport: "http" or "hybrid", Circe hosts interactions with Deno.serve and verifies signatures with Deno’s crypto.subtle.

export default defineCirceConfig({
  config,
  intents: [GatewayIntentBits.Guilds],
  transport: "http",
  http: { publicKey: Deno.env.get("DISCORD_PUBLIC_KEY")!, port: 8787 },
});

Docker

FROM denoland/deno:2.2.0
WORKDIR /app

COPY deno.json ./
RUN deno install

COPY circe.config.ts ./
COPY src/ ./src/

ENV NODE_ENV=production
EXPOSE 8787

CMD ["run", "--allow-net", "--allow-env", "--allow-read", "npm:@sxnnyside/circe/cli", "start"]

Deno Deploy

The http transport is compatible with Deno Deploy. Set transport: "http", deploy the repository and paste the project URL as the Interactions Endpoint URL in the Developer Portal.

SQLite

SqliteCooldownStore needs Deno 2.2+ (it uses node:sqlite) and read/write access to its file.