Installation
This guide walks through the baseline install for a Diadem instance.
Prerequisites
Section titled “Prerequisites”- Node.js 22+
- pnpm
- Running Unown# Stack
Installation
Section titled “Installation”-
Set up the directory
Terminal window git clone https://github.com/ccev/diademcd diadem./setup.shDiadem’s config files need to sit in specific places.
setup.shsets up syslinks to centralize them all in/configfor your convenience. -
Configure
Open
config/config.tomland fill out as needed. Find the reference here. -
Install dependencies and build
Terminal window pnpm installpnpm run build -
Push the internal DB schema
Terminal window pnpm run db:pushThis initializes Diadem tables (users/sessions) in
server.internalDb. -
Run
You may want to run Diadem using pm2.
Terminal window PORT=3900 HOST=127.0.0.1 FORCE_COLOR=1 pm2 start build/index.js -n "diadem"For multi-core production servers, run the cluster entrypoint instead.
DIADEM_WORKERS=autostarts one worker per available CPU core; you can also set a fixed number such asDIADEM_WORKERS=4.Terminal window PORT=3900 HOST=127.0.0.1 FORCE_COLOR=1 DIADEM_WORKERS=auto node cluster.mjs -
Reverse Proxy (optional)
For production use, it’s probably a good idea to set up Diadem behind a reverse proxy. Here’s a configuration for Caddy that works.
example.com {root * /path/to/diadem/buildreverse_proxy * 127.0.0.1:3900}
Running With systemd
Section titled “Running With systemd”For a systemd deployment, point ExecStart at the cluster entrypoint to distribute requests
across CPU cores while keeping a single service and port.
[Unit]Description=DiademAfter=network.target
[Service]Type=simpleWorkingDirectory=/path/to/diademEnvironment=NODE_ENV=productionEnvironment=HOST=127.0.0.1Environment=PORT=3900Environment=FORCE_COLOR=1Environment=DIADEM_WORKERS=autoExecStart=/usr/bin/node cluster.mjsRestart=alwaysRestartSec=5
[Install]WantedBy=multi-user.targetAfter changing the unit, reload and restart it:
sudo systemctl daemon-reloadsudo systemctl restart diademCluster mode starts multiple Diadem processes. Each worker has its own in-memory caches, rate limit counters, and MySQL pools. If strict rate limits matter, account for the worker count or use one worker until rate limiting is backed by shared storage.
Updating
Section titled “Updating”-
Pull the latest changes
Terminal window git pull -
Install dependencies and build
Terminal window pnpm installpnpm run build -
Restart
Terminal window pm2 restart diadem
Docker quick start
Section titled “Docker quick start”For containerized setup using the published ghcr.io/ccev/diadem:latest image:
cp config/config.example.toml config/config.tomlcp docker-compose.example.yml docker-compose.ymldocker compose pulldocker compose up -dThen edit config/config.toml to point to the correct DB and API hosts for your environment.
To update an existing Docker install:
docker compose pulldocker compose up -dDev mode (debugging)
Section titled “Dev mode (debugging)”By default Docker uses the optimized published image. To debug an issue with readable,
unminified code and source maps in your browser devtools, build the local dev target
with a compose override:
cat > docker-compose.override.yml <<'EOF'services: diadem: build: context: . dockerfile: Dockerfile target: dev image: diadem:devEOFecho "DIADEM_TARGET=dev" >> .envdocker compose up -d --buildThis runs the Vite dev server (with its error overlay) instead of node build/index.js.
Remove docker-compose.override.yml, set DIADEM_TARGET=runtime (or remove the line),
and run docker compose pull && docker compose up -d to return to the published image.