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
| Mode | Tenants | Config | Hook URL |
|---|---|---|---|
single | one, implicit | one file | /hooks/<source> |
personal | one owner, many projects | one file, with projects | /hooks/<project>/<source> |
multi | many | a 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 8080init 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.0Point the CLI and the SDK at your gateway
briefkasten use https://hooks.example.com
briefkasten events --followimport { connect } from "briefkasten";
const inbox = connect({ url: "https://hooks.example.com", token: process.env.BRIEFKASTEN_TOKEN });Choose the database, mail and other services
| Port | Options |
|---|---|
| Runtime | Node (@briefkasten/server), or a Cloudflare Worker with a Durable Object per tenant (@briefkasten/cloudflare) |
| Event store | memory, SQLite, Durable Object SQLite |
| Transport | WebSocket (hibernating on Cloudflare) and SSE |
| Config | a file, a directory, or a pulled store |
| Mail, for sign-in codes | Resend, 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.