At a quick glance
What Relaxy! is, technically
Relaxy! is a multipurpose Discord bot first written by me in 2019. It is a pure Node.js program written in modern JavaScript (ES Modules) with JSDoc + TypeScript declaration files for type-checking. There is no build step, the bot runs directly from source. It is sharded and clustered so it can easily scale horizontally across multiple machines.
Live from the hardware
The Pi, right now
Reading live status straight off the Pi…
Architecture
A two-process, multi-cluster model
Relaxy! runs as a supervisor that spawns and watches worker processes.
Manager
src/Manager/Manager.js. The supervisor. It never connects to Discord itself, instead it spawns Clusters, watches their heartbeats, and reclusters or
respawns dead workers. Hosts the cross-process rate limiter and the console command interface.
Cluster / Client
src/Client/Relaxy.js. Each cluster is a child process running one Relaxy client that owns one or more shards. The actual gateway
connections to Discord, where commands and events are handled.
IPC & heartbeats
Manager and clusters talk over Node IPC. Spawn hand-off is the CLIENT_PROCESS_SPAWNED message; liveness uses a push heartbeat (every 3s, 5 missed beats
= dead) so the manager only watches for silence instead of polling.
Self-repair & hot-patch
A SelfRepair module provides hot-reloading of modules/commands and an internet watchdog; the ModuleLoader + HotPatch system loads every module
from a manifest and can swap them at runtime without a restart.
Boot sequence
./startsetsUV_THREADPOOL_SIZE=64and execs Node withnice -n 20,--stack_size=1000,--trace-uncaughtand--max-old-space-size=32768(32 GB V8 heap).- The Manager parses
key.json, empties caches, thenspawn()s clusters sequentially (7s apart). - Each client loads its modules in parallel, connects to MongoDB, spawns the database workers, loads commands, then logs into the Discord gateway, music extractors load in the background, off the critical path.
- Before the clusters report
clusterReady, they launch Mutes, Reminds, TicketSystems, RelaxyForums, ClearingChannels, and every other feature's intervals.
Technology stack
What's inside?
Grouped by what each set of libraries does.
Runtime & language
Discord core & sharding
Database
10 schema "blueprints": Server, Member, Profile, Warning, Reminder, TicketSystem, ForumChannel, HeartBoard, HeartBoardPost and Limits, all persisted through a dedicated database worker with a local cache as well.
Music & voice
Built around a heavily customised player with its own stream interceptor, a biquad/DSP equalizer, and a voice recorder.
Images & canvas
Text & search
Web, networking & utilities
Commands
171 modules across 6 categories
Default prefix =, plus slash-command support.
miscellaneous38 commandsmoderation33 commandsimage30 commandsadministrator25 commandsmusic24 commandsfun21 commands
File structure
How the source is organised
relaxy-private/ ├── start # launcher: ./start [--client], sets Node flags ├── index.js # root entry -> boots the manager ├── detect_os.js # host detection (void / raspberry-pi / windows / linux) ├── package.json # ESM, ~80 dependencies, no build step ├── tsconfig.json / jsconfig.json ├── bot/ # process entry points + handlers │ ├── Manager.js # supervisor process entry │ ├── Client.js # cluster/client process entry │ ├── commands/ # 171 commands in 6 categories │ │ ├── administrator/ fun/ image/ │ │ └── miscellaneous/ moderation/ music/ │ └── events/ # discord/ + music/ event handlers ├── src/ # the engine │ ├── ModuleLoader.js HotPatch.js MainFrame.js DataTable.js │ ├── Manager/ │ │ ├── Manager.js │ │ ├── Core/ # SelfRepair, HeartBeatManager │ │ └── Modules/ # ClusterSpawnProcessor, ConsoleInputProcessor │ └── Client/ │ ├── Relaxy.js # the bot client │ └── Modules/ │ ├── Database/ # Mongoose models (Blueprints) + Database │ ├── MusicPlayer/ # custom player, equalizer, extractors │ ├── VoiceRecorder/ Handlers/ Workers/ │ └── ADSR/ # active diagnosis + rate limiter ├── types/ # 14 .d.ts type declarations ├── assets/ # config, images, fonts, sounds, text, scripts ├── storage/ # runtime caches (users / guilds) └── docs/ # STARTUP.md and other internals
Deployment
Where it runs
Relaxy! detects its host at startup (detect_os.js) and adapts. Thanks to discord-cross-hosting the shards can be spread across these machines
at once.
Void PC HOST_TYPE = void
The primary host is a Void Linux desktop. Detected by reading ID=void from /etc/os-release. Carries the bulk of the clusters and shards.
Raspberry Pi HOST_TYPE = raspberry-pi
An always-on ARM board, detected via arm/arm64 architecture. Acts as a low-power node that keeps a slice of the fleet alive around the clock.
Laptop HOST_TYPE = windows / linux
A secondary / development host. Used for debugging single shards (./start --client) and to add capacity when needed.