Architecture

What Sahir Venn actually stores, why a Discord Application exists at all, the hosted-vs-self-hosted choice, and the full request path from clicking Add to Discord to a live /dune server status reply.

mentat v1.0.0-rc.5 schema v7
01

What's stored

Every hosted-mode deployment (including the shared Sahir Venn instance) keeps one file, data/acp.db. It's deliberately narrow — no Discord message content, no copy of anyone's game database, no Docker access, no Steam credentials — and it got narrower still in a recent hardening pass: four things left, down from ten.

TableHoldsWhy it has to be here
guilds Console URL, encrypted adapter token, status, and (opt-in) live-stats-sharing secret The bot is a separate process from your console — it has no other way to know where your console lives or how to authenticate to it. This is the one real credential this system holds.
guild_roles Which Discord role ID maps to which command tier Your own choice of role mapping, cached so a denial can be instant instead of a wasted round trip. Your own Core console independently re-checks every request anyway — see below.
guild_settings RBAC mode, cooldowns, schedule/announcement channel Configuration, not identity data.
key_versions, secret_keys, secret_access_log Key-rotation bookkeeping and an audit trail Never the secrets themselves — just how the adapter token above is encrypted at rest, and a record of when it was touched.
What used to be here, and isn't anymore

Removed entirely: a Discord-to-character link table that turned out to have zero callers anywhere in the codebase — that mapping has always actually lived in your own Core console's database, not the bot's. A member-activity log that existed only to auto-pick a cosmetic embed color has been removed along with that feature.

Moved to memory, never written to disk: OAuth setup-wizard sessions (they only need to survive a few minutes), a command counter, and the live-stats display cache. None of it needs to outlive a restart to be correct.

02

Why a Discord Application is required at all

This isn't a design choice we made — it's a Discord platform requirement, and it applies to every Discord bot that has ever existed, including the big ones. Four things are all tied to it:

  1. The persistent Gateway connection. Receiving slash commands in real time needs a long-lived connection authenticated with a bot token — and a bot token only exists because an Application minted it.
  2. Slash-command registration. /dune ... and its autocomplete are registered against an Application ID.
  3. "Add to Server." The invite link is a literal OAuth2 request against one Application's client ID.
  4. "Sign in with Discord" on the setup portal. Confirming you actually administer your server before letting you configure it is its own OAuth2 exchange.

So the real question was never "does this need an Application" — it's who owns it: one we run and every server shares, or one you register and own yourself. Both run the exact same code.

"But other bots like YAGPDB don't need an app"

They do — there's no way for a Discord bot to exist without one. What you're noticing is that you never create one, because you're using YAGPDB's own hosted Application, the same way Sahir Venn's hosted path works. Scaling one Application to hundreds of thousands of servers is Discord's Gateway sharding — multiple connections under one bot token — not multiple Applications. And YAGPDB is itself open source and self-hostable, with your own Application, if you want that instead: the same hosted-plus-self-hosted split described below, not a counter-example to it.

03

Hosted or self-hosted — two real choices

Both are the exact same open-source code. The only difference is whose name is on the Discord Application, and where your adapter token lives.

Hosted (Sahir Venn)

Fastest to set up

  • +No Discord Application to register — click Add to Discord and connect your console through the setup portal
  • +Guided onboarding, automatic command registration, no process to run yourself
  • −Your adapter token is held on infrastructure you don't control, decrypted in-process to make each request
  • −You depend on our uptime for the bot to respond at all

Self-hosted

Full control

  • +Your own Discord Application, your own bot token, your own adapter token — none of it ever leaves your infrastructure
  • +No dependency on anyone else's uptime
  • +You audit the exact code running against your console, and update on your own schedule
  • −Register a free Discord Application yourself (~15 minutes), then run and monitor the process

If you already run your own Discord integration against your console's adapter API, self-hosting Sahir Venn is a drop-in swap — same trust footprint you already have today, more capability. See the self-hosted install guide to get started either way.

04

End-to-end: "Add to Discord" → /dune server status

Two views of the same system: the components and trust boundaries, then the literal sequence of calls. Both describe the hosted path — self-hosting is the identical diagram narrowed to one server and one Application.

System components

flowchart LR
    subgraph DC["Discord Platform"]
        GW["Gateway
(persistent connection)"] OAUTH["OAuth2
(Add to Server / Sign in)"] INT["Interactions
(/dune commands)"] end subgraph BOT["Sahir Venn (Bot Process)"] CLIENT["Discord client"] SETUP["Setup portal
/setup, /oauth/callback"] DB[("SQLite
guilds, guild_roles,
guild_settings")] ADAPTERCLIENT["Adapter client"] end CORE["Your Core Console
Discord adapter API"] GW <-->|persistent connection| CLIENT OAUTH -->|redirects| SETUP INT -->|command payload| CLIENT SETUP <-->|reads/writes| DB CLIENT --> ADAPTERCLIENT ADAPTERCLIENT -->|look up console URL + token| DB ADAPTERCLIENT -->|"Bearer adapter token"| CORE CORE -->|JSON status/readiness/etc.| ADAPTERCLIENT

Request sequence

sequenceDiagram
    actor You as You
    participant D as Discord
    participant B as Sahir Venn
    participant C as Your Core Console

    You->>D: Click "Add to Discord"
    D->>You: Consent screen — pick a server, review permissions
    You->>D: Approve
    D->>B: Bot joins your server
    B->>You: DM with a link to the setup portal

    Note over You,C: On your own console, separately:
enable the adapter, generate a token file, restart the container You->>B: Open the setup link B->>D: Sign in with Discord (confirms you administer this server) D->>B: Confirmed B->>You: Configuration form You->>B: Console URL, adapter token, role mapping B->>B: Stores your config (adapter token encrypted at rest) B->>You: Setup complete Note over You,C: --- later, in any channel --- You->>D: /dune server status D->>B: Command received B->>B: Check your role against the configured mapping B->>C: Request status (Bearer adapter token) C->>B: JSON status B->>D: Formatted reply D->>You: Response appears in the channel

Everything after "look up console URL + token" happens over a direct connection from wherever the bot runs to wherever your console is reachable — our infrastructure is never in that specific hop, hosted or self-hosted.

05

FAQ

Which install option should I actually pick?

If you want it working in the next five minutes and don't mind us holding your console's access key, use the hosted bot. If you'd rather nothing about your server ever leaves your own infrastructure, self-host — it's the same code, ~15 minutes of setup, and no ongoing dependency on us. See Two Ways to Run Sahir Venn for the plain-language version of this same comparison.

What exactly do you store if I use the hosted bot?

Four things, per the table in §01 above: your console's address and an encrypted access key, your Discord role → command-tier mapping, a few configuration settings, and — only if you opt in — a public aggregate counter (players online, spice fields, sietches) for this site's stats bar. Nothing else. No message content, no game database, no Steam data.

What do you store if I self-host instead?

Nothing. A self-hosted instance runs entirely on your own infrastructure, with your own Discord Application and your own database — we're never in the request path and never hold any of your data.

Can I switch between hosted and self-hosted later?

Yes, either direction, at any time — there's no migration or lock-in. You're choosing where the same software runs, not committing to a different product.