CatRealm Self-Hosted Server

Welcome to the CatRealm self-hosting documentation. Get your own CatRealm chat server running in minutes — on Windows, Linux, or through a Pterodactyl panel.

CatRealm is an open-source, self-hostable chat platform with text channels, voice chat, roles, permissions, and more. These docs cover everything you need to deploy and configure your own instance.

Dependencies

CatRealm requires very few dependencies to run:

DependencyVersionNotes
Node.jsv20 or higherv24 LTS recommended for best compatibility
GitAny recent versionOptional — required only for auto-update feature
The startup scripts (Start.bat / Start.sh) can automatically detect and install missing dependencies for you.

OS Support

PlatformSupportNotes
Windows 10 / 11Supportedx64 recommended. Uses Start.bat
Linux (Ubuntu, Debian, etc.)SupportedUbuntu 20.04+, Debian 10+, or any modern distro
macOSExperimentalUses Start.sh — works but not officially tested
PterodactylSupportedOfficial egg available — see Pterodactyl section

Windows Server

The easiest way to get started on Windows — no terminal required.

Manual Install

1
Download or clone the repository

Download the latest release as a ZIP, or clone with Git:

git clone https://github.com/VanillaChan6571/CatRealm-SelfHostable-Server.git
cd CatRealm-SelfHostable-Server
2
Run Start.bat

Double-click Start.bat in the folder. If Node.js is missing or outdated, depinstaller.bat will launch automatically — it uses Windows Package Manager (winget) and may request a UAC prompt.

3
Configure your .env

On first launch the server will create a .env file and open it in your default editor. Set at minimum your SERVER_NAME and any optional settings, then save.

4
Re-run Start.bat

After saving your config, run Start.bat again. The server will start on port 40500 by default.

5
Access your server

Open a browser and go to http://localhost:40500. To allow other devices, update SERVER_URL in your .env to your local IP.

⚠️
SSL required for web app access from other devices. The CatRealm Client requires HTTPS to connect remotely. See the SSL guide below for how to enable it.

Linux Server

Run CatRealm on any modern Linux distribution.

Auto Installer

The fastest way to install CatRealm on Linux is the hosted auto-installer:

bash <(curl -fsSL https://raw.githubusercontent.com/VanillaChan6571/CatRealm-SelfHostable-Server/refs/heads/main/catrealm-auto-installer.sh)
ℹ️
This launches the guided installer menu, installs the required runtime, and can configure the server for you.

Manual Install

1
Clone the repository
git clone https://github.com/VanillaChan6571/CatRealm-SelfHostable-Server.git
cd CatRealm-SelfHostable-Server
2
Make the start script executable
chmod +x Start.sh
3
Run the start script
./Start.sh

If Node.js is not installed or outdated and you have nvm, you'll be offered automatic installation. Otherwise you'll receive manual instructions.

4
Configure your .env

On first run, a .env file is created from the example template. Edit it to set your server name and any other settings, then save.

nano .env
5
Re-run Start.sh

The server will start on port 40500 by default. Check the logs printed to the terminal to confirm it's running.

Manual Installation

If you prefer to skip the launcher scripts:

npm install --omit=dev
cp .env.example .env
nano .env          # edit your configuration
node src/index.js  # start the server

Running with PM2 (Production)

For a persistent, production-grade setup, use PM2:

# Install PM2 globally
npm install -g pm2

# Start CatRealm
pm2 start src/index.js --name catrealm

# Auto-start on system reboot
pm2 startup
pm2 save
ℹ️
View live logs with pm2 logs catrealm and check status with pm2 status.

Pterodactyl Egg

CatRealm has an official Pterodactyl egg for easy panel-based hosting.

Hoster Setup

1
Import the egg into your panel

In Pterodactyl, go to Admin → Nests → Import Egg and use this URL:

https://raw.githubusercontent.com/VanillaChan6571/CatRealm-SelfHostable-Server/main/pterodactyl-egg/egg-cat-realm-server.json
2
Create a new server using the egg

Create a server in your panel, select the CatRealm egg, and choose a CatRealm Runtime image. The current runtime includes ffmpeg, yt-dlp, build tools, and livekit-server.

3
Configure startup variables

The egg exposes the following startup variables you can configure in the panel:

VariableDefaultDescription
AUTO_UPDATEtruePull latest changes from Git on every startup
GIT_REPOOfficial repo URLGit repository to pull from
GIT_BRANCHmainBranch to pull
4
Start the server

Start your Pterodactyl server. On first boot, the egg installs dependencies, copies the .env.example template, and starts CatRealm. Configure your .env via the panel's file manager, then restart.

💡
The SERVER_PORT variable is auto-detected by Pterodactyl — you don't need to set it manually. The panel allocates a port for you.

Hosting Features

One CatRealm installation can host multiple independent realms, run first-party bot plugins, and relay mention notifications to central-account mobile users.

Multi-Realm Hosting Optional

Multi-realm mode runs several isolated realms from one installation. Each realm has its own HTTP/WebSocket port, SQLite database, users, roles, messages, and secrets. The realms share the repository, dependencies, uploads, TLS certificate, and one LiveKit media service.

Per realmShared by all realms
Port and SQLite databaseRepository and node_modules
Users, roles, messages, and settingsUploads and UGC folders
JWT_SECRET and secure-mode keyLiveKit and TLS certificate
1
Stop the server and enable the supervisor
MULTI_REALM=true
2
Start CatRealm normally

On first boot, CatRealm safely copies the existing database to data/<port>.db, keeps data/catrealm.db.pre-multirealm.bak, and creates data/realms.json.

3
Add realms in data/realms.json
{
  "version": 1,
  "realms": [
    { "port": 40500, "name": "Main Realm", "dbFile": "40500.db", "enabled": true },
    { "port": 40501, "name": "Second Realm", "dbFile": "40501.db", "enabled": true }
  ]
}

Restart after editing. Per-realm overrides and generated secrets live in data/realms/<port>.env.

⚠️
Back up data/realms/ with the databases. Losing a realm's JWT secret logs everyone out; losing its secure-mode key makes encrypted messages unrecoverable. Do not set CATREALM_SERVER_ID in multi-realm mode.

Bots & Plugins

CatRealm supports token bots that run anywhere and plugin bots that the server runs as child processes. Both are real realm members: assign roles to grant server permissions, while each user separately approves requested consent scopes such as profile access, mentions, and Bot DMs.

Token botPlugin bot
CreateRealm Settings → BotsAdd realm-plugins/<name>/bot.json
RunsYour process or hostChild process of the realm server
CredentialShown once; regenerableGenerated on every server boot
{
  "name": "greeter",
  "username": "GreeterBot",
  "entry": "index.js",
  "scopes": ["interactions", "mentions"],
  "commands": [
    { "name": "greet", "description": "Say hello", "options": [] }
  ]
}

If a plugin has uninstalled npm dependencies, CatRealm waits for owner approval. Approve it from Realm Settings → Bots or with botinstall <name> in the server console.

🔴
Only install trusted plugins. Plugin processes have the same filesystem permissions as the server user. Process isolation protects against crashes, not malicious code.

Push Notification Relay Central Accounts

Self-hosted realms can relay channel @mention notifications to CatRealm mobile devices. This only applies to users signed in with a central CatRealm account; local-only accounts do not have central push tokens.

Generate a secret, add it to .env, and restart. The realm registers itself automatically with the central service using its public SERVER_URL.

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
PUSH_RELAY_SECRET=paste-your-generated-secret
AUTH_SERVER_URL=https://auth.catrealm.app

ENV Overview

CatRealm is configured through environment variables in your .env file. Below are the common settings from the current server template, including the latest hosting and media options.

⚠️
Never commit your .env file to version control. It contains secrets like JWT_SECRET and optional API tokens.

Server

Core settings that define how your server presents itself.

VariableDefaultDescription
PORT40500Port the server listens on
SERVER_NAMEMy CatRealm ServerDisplay name shown to users
SERVER_DESCRIPTIONA self-hosted CatRealm serverShort description shown on the server listing
SERVER_URLhttp://0.0.0.0:40500Canonical server URL. Use the public HTTPS URL when enabling push relay or central media fallback.
PUBLIC_SERVER_URLOptional public origin used for generated invite links; falls back to SERVER_URL.
# ── Server ────────────────────────────────────────────────────
PORT=40500
SERVER_NAME=My CatRealm Server
SERVER_DESCRIPTION=A cozy self-hosted realm

Security

Authentication and encryption settings.

VariableDefaultDescription
JWT_SECRETauto-generatedSecret used to sign JSON Web Tokens. Change this in production.
SECURE_MODE1 in new templatesMessage-at-rest encryption. 0 = disabled, 1 = enabled and permanently locked for that database
SECURE_MODE_KEYauto-generated when enabledEncryption key for secure mode. Can be set manually (min 16 chars).
🔴
Once SECURE_MODE=1 is set for a database, it cannot be reversed. CatRealm records the lock in the database and ignores a later attempt to disable it. Back up SECURE_MODE_KEY; without the original key, encrypted messages cannot be recovered.
# ── Security ──────────────────────────────────────────────────
JWT_SECRET=change-this-to-a-long-random-string
SECURE_MODE=1
# SECURE_MODE_KEY=    # auto-generated when SECURE_MODE=1

Registration

Control whether new users can sign up on your server.

VariableDefaultDescription
REGISTRATION_OPENtrueSet to false to close registrations (invite-only mode)
# ── Registration ──────────────────────────────────────────────
REGISTRATION_OPEN=true

Database

CatRealm uses SQLite — no external database server needed.

VariableDefaultDescription
DB_PATH./data/catrealm.dbPath to the SQLite database file
ℹ️
Database migrations run automatically on every server startup. You never need to run migrations manually.
# ── Database ──────────────────────────────────────────────────
DB_PATH=./data/catrealm.db

Hosting Features

VariableDefaultDescription
MULTI_REALMfalseRun the multi-realm supervisor. Realm definitions are stored in data/realms.json.
BOTS_PLUGINS_ENABLEDtrueEnable plugin discovery and child processes under realm-plugins/. Token bots remain available when disabled.
PUSH_RELAY_SECRETSecret used to register the realm for central-account mention push notifications. Use at least 32 random characters.
AUTH_SERVER_URLhttps://auth.catrealm.appCentral authentication, push relay, and optional media-fallback service.
# Optional hosting features
MULTI_REALM=false
BOTS_PLUGINS_ENABLED=true
# PUSH_RELAY_SECRET=generate-a-random-32-byte-secret

CORS

Controls which origins can make requests to your server's API.

VariableDefaultDescription
CLIENT_URL*Allowed client origin. Use * for open access, or set to your client's exact URL in production (e.g. https://app.example.com)
# ── CORS ──────────────────────────────────────────────────────
CLIENT_URL=*
# Production example:
# CLIENT_URL=https://app.example.com

Uploads Directory

Paths where user-uploaded files are stored on disk.

VariableDefaultDescription
UPLOADS_DIR./data/uploadsDirectory for user avatar uploads
UGC_IMAGES_DIR./data/ugc/imagesDirectory for user-generated content images (role icons, etc.)
# ── Uploads ───────────────────────────────────────────────────
UPLOADS_DIR=./data/uploads
UGC_IMAGES_DIR=./data/ugc/images

Default Local Avatar Image Local Accounts Only

Set a default avatar URL for newly created local accounts. If not set, users will have no avatar until they upload one.

VariableDefaultDescription
DEFAULT_AVATAR_URLFull URL to a default avatar image (optional)
# Optional: default avatar for new local accounts
DEFAULT_AVATAR_URL=https://cdn.example.com/default-avatar.png

Block Generic Usernames Decentral Only

Prevent users from registering with reserved or common usernames (e.g. "admin", "moderator"). Only applies to local (decentral) accounts.

VariableDefaultDescription
BLOCKED_USERNAMESComma-separated list of blocked usernames (case-insensitive exact match)
BLOCKED_USERNAMES_FILE./blocked-usernames.txtPath to a newline-separated file of blocked usernames
# Block specific usernames from registration (local/decentral accounts only)
BLOCKED_USERNAMES=admin,moderator,official,support
# Or use a file (one username per line):
BLOCKED_USERNAMES_FILE=./blocked-usernames.txt

Server Mode

Controls what type of accounts are allowed to join your server.

ModeDescription
mixedBoth local accounts and central CatRealm accounts are accepted.
decentral_onlyRuntime default when unset. Only local accounts created on this server; no central auth required.
central_onlyOnly central CatRealm accounts are accepted. Local registration is disabled.
VariableDefaultDescription
SERVER_MODEdecentral_onlyAccount mode for this server
AUTH_SERVER_URLhttps://auth.catrealm.appCentral auth server URL used by mixed / central_only
# Server mode (optional — runtime defaults to decentral_only)
# SERVER_MODE=mixed            # both local and central
# SERVER_MODE=decentral_only   # local accounts only (default)
# SERVER_MODE=central_only     # central accounts only

# Required for mixed/central_only:
# AUTH_SERVER_URL=https://auth.catrealm.app

Media Limits

Configure upload size limits for different types of media.

VariableDefaultDescription
MEDIA_MAX_MB20Maximum size (MB) for media file uploads in chat
COMPRESS_MEDIA0Set to 1 to compress chat images and MP4 video after upload. GIF, APNG, expressions, and server assets are excluded.
LEVEL_OF_COMPRESSION6Compression strength from 09. Higher values use more CPU and reduce quality/size.
AVATAR_MAX_MB10Maximum size (MB) for avatar image uploads
THEATER_UPLOAD_MAX_MB2048Default Theater upload limit; owners can adjust it in Realm Settings.
THEATER_UPLOAD_HARD_MAX_MB10240Hard ceiling for the owner-configurable Theater upload limit.
THEATER_UPLOAD_RESERVE_MB256Disk space CatRealm keeps free when accepting Theater uploads.
MAX_PINS300Maximum number of pinned messages per channel
MENTION_ALIAS@everyoneAlias for mentioning all members in a channel
# ── Media Limits ──────────────────────────────────────────────
MEDIA_MAX_MB=20
COMPRESS_MEDIA=0
LEVEL_OF_COMPRESSION=6
AVATAR_MAX_MB=10
MAX_PINS=300
MENTION_ALIAS=@everyone

Voice & Theater Media

Current CatRealm clients use LiveKit for voice, camera, screen sharing, and Theater. Use bundled LiveKit, connect an external LiveKit deployment, or enable the authenticated central fallback.

VariableDefaultDescription
HOST_LIVEKIT_MEDIAfalseRun the bundled LiveKit sidecar. Requires livekit-server; the CatRealm Pterodactyl runtime includes it.
LIVEKIT_PUBLIC_HOSTSSL_DOMAINPublic hostname used by clients when media has a different hostname.
LIVEKIT_RTC_TCP_PORT7881Public TCP fallback port for LiveKit media.
LIVEKIT_RTC_UDP_PORT_START50000First allocated UDP media port.
LIVEKIT_RTC_UDP_PORT_END50100Last allocated UDP media port; may equal the start port for a small host.
CENTRAL_LIVEKIT_FALLBACKfalseUse CatRealm central media for voice and Theater when local LiveKit is unavailable. Requires PUSH_RELAY_SECRET and a public server URL.
MEDIA_TOKEN_TTL_SECONDS600Participant-token lifetime, clamped between 60 and 3600 seconds.
# Bundled LiveKit example
HOST_LIVEKIT_MEDIA=true
LIVEKIT_PUBLIC_HOST=media.example.com
LIVEKIT_RTC_TCP_PORT=7881
LIVEKIT_RTC_UDP_PORT_START=50000
LIVEKIT_RTC_UDP_PORT_END=50100
ℹ️
LiveKit signaling is proxied through CatRealm at /rtc in bundled mode, but the TCP media port and every UDP port in the configured range must still be reachable publicly.

Auto Update

When enabled, the startup launcher will pull the latest changes from your configured Git repository before starting the server.

VariableDefaultDescription
AUTO_UPDATEtrueEnable or disable auto-update on startup
GIT_REPOOfficial repo URLGit repository to pull updates from
GIT_BRANCHmainGit branch to pull from
ℹ️
Auto-update only runs if a .git directory is present. If you downloaded a ZIP release, auto-update will not run.
# ── Auto Update ───────────────────────────────────────────────
AUTO_UPDATE=true
GIT_REPO=https://github.com/VanillaChan6571/CatRealm-SelfHostable-Server.git
GIT_BRANCH=main

SSL / HTTPS Guide

HTTPS is required to use the CatRealm web app from any device other than localhost. CatRealm has built-in SSL support powered by Let's Encrypt — no separate reverse proxy needed.

Auto SSL via Cloudflare DNS Recommended

This method uses the DNS-01 ACME challenge, which means port 80 does not need to be open. It's ideal for servers behind firewalls or NAT. You just need a domain pointed to Cloudflare and a Cloudflare API token.

1
Point your domain to Cloudflare

Ensure your domain (e.g. chat.example.com) has an A record in Cloudflare DNS pointing to your server's public IP. Use DNS only (gray cloud) for any hostname that carries LiveKit media ports.

2
Create a Cloudflare API token

Follow the steps below in the Cloudflare dashboard:

1 Click your profile icon in the top-right corner
Cloudflare dashboard — click profile icon top-right
2 Select API Tokens from the left sidebar
My Profile page — click API Tokens in sidebar
3 Find Edit zone DNS and click Use template
API token templates — click Use template next to Edit zone DNS
4 Leave permissions as-is, then click Continue to summary
Create Custom Token form — click Continue to summary
5 Review the summary and click Create Token
Token summary page — click Create Token
6 Copy your token — it will not be shown again
Token created — copy and save your token
⚠️
Save the token immediately. Cloudflare will not show it again after you leave the page. If you lose it, you'll need to delete it and create a new one.
3
Add SSL variables to your .env
# Auto-SSL via Cloudflare DNS-01
SSL_DOMAIN=chat.example.com
SSL_EMAIL=[email protected]
SSL_DNS_PROVIDER=cloudflare
SSL_DNS_API_TOKEN=your-cloudflare-api-token
4
Restart the server

CatRealm will automatically request a certificate from Let's Encrypt using the Cloudflare DNS challenge. Once issued, the server will serve HTTPS on port 443 and HTTP on your configured PORT.

💡
Certificates are automatically renewed before expiry — you don't need to do anything. Cloudflare DNS is the recommended method because it works without port 80.

SSL via Certbot

If you prefer to manage certificates manually, you can obtain them with Certbot and provide the paths to CatRealm.

1
Install Certbot
sudo apt update
sudo apt install -y certbot
2
Obtain a certificate

Using the standalone HTTP challenge (requires port 80 to be temporarily free):

sudo certbot certonly --standalone -d chat.example.com --email [email protected] --agree-tos

Certificates are saved to /etc/letsencrypt/live/chat.example.com/.

3
Point CatRealm at your certificates
# Manual certificate paths
SSL_CERT_PATH=/etc/letsencrypt/live/chat.example.com/fullchain.pem
SSL_KEY_PATH=/etc/letsencrypt/live/chat.example.com/privkey.pem
4
Set up auto-renewal

Certbot installs a renewal cron job automatically. Ensure CatRealm reloads after renewal by adding a post-renewal hook:

# /etc/letsencrypt/renewal-hooks/post/catrealm.sh
#!/bin/bash
pm2 restart catrealm
chmod +x /etc/letsencrypt/renewal-hooks/post/catrealm.sh
⚠️
With manual certificates, remember to set up auto-renewal and a post-hook restart. Expired certificates will prevent users from connecting.

Advanced

Advanced configuration for power users and production deployments.

Connect External LiveKit

Use an external LiveKit deployment when media should run on separate infrastructure. CatRealm keeps the API secret server-side and mints short-lived participant tokens for clients.

VariableDescription
MEDIA_LIVEKIT_ENABLEDSet to true to enable the external provider.
MEDIA_LIVEKIT_URLInternal URL CatRealm uses for LiveKit server API calls.
MEDIA_LIVEKIT_PUBLIC_WS_URLPublic wss:// URL given to clients.
MEDIA_LIVEKIT_API_KEYLiveKit API key.
MEDIA_LIVEKIT_API_SECRETLiveKit API secret. Never expose this in client configuration.
MEDIA_LIVEKIT_ENABLED=true
MEDIA_LIVEKIT_URL=http://127.0.0.1:7880
MEDIA_LIVEKIT_PUBLIC_WS_URL=wss://media.example.com
MEDIA_LIVEKIT_API_KEY=your-api-key
MEDIA_LIVEKIT_API_SECRET=your-api-secret
MEDIA_TOKEN_TTL_SECONDS=600

Firewall Checklist

  • Expose the public secure WebSocket endpoint used for LiveKit signaling.
  • Expose LiveKit's configured TCP media fallback port.
  • Expose the full configured UDP media range.
  • Keep the API secret on the CatRealm server only.
💡
For Pterodactyl, select the CatRealm runtime image and use HOST_LIVEKIT_MEDIA=true unless you already operate an external LiveKit deployment.