Skip to content

Running From Source

arielaram edited this page Nov 16, 2026 · 1 revision

Running From Source

Use this when you want to change the code, or run on a platform without a release binary. You need Bun and Git.

Requirements

  • Bun (the project uses bun)
  • Node.js 22 or newer (engines in package.json)
  • Git

Setup

git clone https://github.com/nationdex/bot.git nationdex
cd nationdex
bun install
bun run build

Create .env in the same folder (see Configuration).

Start

Command What it does
bun run start Runs the built dist/index.js
bun run dev Rebuilds and reruns on file changes
bun run build Compiles src/ to dist/ with tsc
bun run typecheck Type-checks without writing files
bun run lint ForgeLint checks the ForgeScript code strings

If a deleted command still shows in Discord, run rm -rf dist/ && bun run build and restart.

Build your own binary

bun run build:binary          # Linux x64, output in binaries/
bun run build:binary:arm64    # Linux ARM64

Before building, run bun run bundle:prep. It regenerates src/bundle-imports.ts, which the bot needs whenever functions, commands or routes are added or removed.

Notes

  • Only one process may use ./database. Stop the bot before running any script that touches the database.
  • Do not run tests or scripts against ./database while the bot is running. Query the API on port 2222 instead.
  • The panel rebuilds its UI on boot when its sources are newer than website/dist. You can also run bun run panel:build.

See also Hosting for running it as a service.

Clone this wiki locally