Skip to content
briefkastencloud

Self-hosting

Run the open-source gateway yourself, on Node or Cloudflare, in single, personal or multi mode.

The gateway is open source and briefkasten cloud runs the same code. The CLI, the SDK, the API and the MCP tools work the same against your own instance.

Modes

ModeTenantsConfigHook URL
singleone, implicitone file/hooks/<source>
personalone owner, many projectsone file, with projects/hooks/<project>/<source>
multimanya config store/t/<tenant>/hooks/<project>/<source>

Start a gateway

The CLI runs the gateway; install it with npm install -g @briefkasten/cli (Node 22.13 or newer).

briefkasten init --mode personal --public-url https://hooks.example.com
briefkasten project add acme-shop
briefkasten source add github --project acme-shop
briefkasten token create --name my-server --project acme-shop
briefkasten server --port 8080

init writes briefkasten.config.json; you can edit it by hand and review it in a pull request. server runs the gateway of that file. To keep the management API private and only the hooks public, give the hooks their own listener:

briefkasten server --port 8080 --host 127.0.0.1 --webhook-port 8443 --webhook-host 0.0.0.0

Point the CLI and the SDK at your gateway

briefkasten use https://hooks.example.com
briefkasten events --follow
import { connect } from "briefkasten";

const inbox = connect({ url: "https://hooks.example.com", token: process.env.BRIEFKASTEN_TOKEN });

Choose the database, mail and other services

PortOptions
RuntimeNode (@briefkasten/server), or a Cloudflare Worker with a Durable Object per tenant (@briefkasten/cloudflare)
Event storememory, SQLite, Durable Object SQLite
TransportWebSocket (hibernating on Cloudflare) and SSE
Configa file, a directory, or a pulled store
Mail, for sign-in codesResend, Cloudflare Email Sending, SMTP, console

Move between briefkasten cloud and your own gateway

Projects and sources are config: export them from one and create them on the other, then point the providers at the new hook URLs. The CLI keeps one sign-in per target, so you can manage both from one terminal.