Setup Wizard
bun run setup is the recommended self-host path for local Bun-based installs. The command installs the dependencies from bun.lock before loading the wizard, including on a fresh clone. The wizard creates your .env, generates a CRYPTO_SECRET, asks for your Discord bot token, asks whether to allow private networks, and configures PostgreSQL. It’s safe to re-run; existing .env values are kept unless you choose to reconfigure them.
What to have ready
Section titled “What to have ready”Before starting, make sure you have:
- A Discord bot token with the
GuildMembers,MessageContent, andGuildPresencesprivileged intents enabled. - Bun to run the bot and the wizard itself.
- PostgreSQL installed, or Docker if you want the wizard to run a PostgreSQL container for you. TomoriBot stores everything in PostgreSQL and initializes its schema, seeds, migrations,
pgcrypto, and RAG schema automatically on first startup. - Node.js v20+ (optional) if you plan to use MCP servers launched with
npx.
Install Bun in PowerShell if it is not already installed:
powershell -c "irm bun.sh/install.ps1 | iex"For PostgreSQL, install either PostgreSQL for Windows (including psql and pg_dump on PATH) or Docker Desktop. Docker Desktop is the easiest way to get pgvector and pg_cron on Windows without compiling extensions from source.
Install Bun if it is not already installed:
curl -fsSL https://bun.sh/install | bashInstall PostgreSQL and its client tools (psql and pg_dump), or install Docker Engine with the Compose v2 plugin (docker compose). On Debian or Ubuntu:
sudo apt-get update && sudo apt-get install -y postgresql postgresql-clientInstall Bun with the official installer or Homebrew:
curl -fsSL https://bun.sh/install | bashInstall PostgreSQL via Homebrew (or Docker Desktop):
brew install postgresql@17brew services start postgresql@17Get the code
Section titled “Get the code”git clone https://github.com/Bredrumb/TomoriBot.gitcd TomoriBotRun the wizard
Section titled “Run the wizard”Run the setup wizard using:
bun run setupOnce you run the command, you’ll pick one of two paths:
| Path | Use When | What It Does |
|---|---|---|
| Full Install | You want the recommended setup with lightweight extras. | Runs Base Install, then attempts the extras below. |
| Base Install | You want only the minimum working bot. | Creates/configures .env, Discord token, PostgreSQL, and dependencies. |
Private networks
Section titled “Private networks”The wizard asks whether TomoriBot may reach localhost and your LAN, and saves the answer as ALLOW_PRIVATE_NETWORK in .env. Outside production TomoriBot won’t start until it is set, so a setup made by hand needs the line too. Any member who can add a custom endpoint or MCP server can reach whatever you allow here, so pick by who uses the bot:
| Value | Choose it when |
|---|---|
true | Only you or a trusted Discord community uses the bot. Local models and MCP servers on localhost or your LAN work, including over plain HTTP. |
A host:port list, such as localhost:5001,localhost:8188 | You share local servers, such as KoboldCPP or ComfyUI, with members you don’t fully trust. Only the listed servers work, so their endpoints can’t reach anything else on your network. |
false | Untrusted members use the bot and you share no local server. |
Public HTTPS endpoints, such as hosted OpenAI-compatible APIs, work with every value. For a model on another machine, use an authenticated remote connection. A tunnel supplies connectivity and needs separate access controls. Production refuses private endpoints regardless of ALLOW_PRIVATE_NETWORK.
A list matches the address exactly as an endpoint is registered, so localhost:5001 doesn’t cover 127.0.0.1:5001; list each spelling you use. A listed server is still open to every member, on any path, so keep its own admin features behind a password (for KoboldCPP, --adminpassword).
Tailscale addresses and *.ts.net names count as private, so they need true or a list; with false, only Tailscale Funnel works.
Images, files, and link previews that members post never reach private addresses, whatever you choose. The fetch_url tool has its own setting, FETCH_URL_ALLOW_PRIVATE_NETWORK (off by default).
Full Install extras
Section titled “Full Install extras”Full Install runs Base Install first, then tries to install the extras below. If any fails, it prints the command or guide to finish manually and keeps going:
| Extra | Purpose |
|---|---|
pgvector | Vector search for document/RAG memory. |
pg_cron | Optional scheduled cooldown/reminder-row cleanup. |
| Tokenizer assets | Local tokenizer assets for NovelAI text generation and model-aware logit bias. |
To install any of these by hand, see the Manual Setup extras.
After setup
Section titled “After setup”bun run dev # bot onlybun run launch --searxng --crawl4ai # bot + local servers (see bun run launch --help)When the bot is online, run /setup in Discord. It walks you through connecting an AI provider or to your custom endpoint.
Updating
Section titled “Updating”Use the backup-first updater command: bun run update
This runs bun run backup, then git pull --rebase --autostash, then bun install --frozen-lockfile. Add --build if you run from dist/, or --docker for a Compose deployment. Full details on the Maintenance & Backups page.