-
Notifications
You must be signed in to change notification settings - Fork 7
Standalone Instance
SleepyPxnda edited this page Feb 27, 2026
·
4 revisions
This example shows how to launch Galactic in standalone mode, running multiple clusters and shards on a single machine for efficient scaling.
Create an index.ts file to launch the standalone instance.
import {StandaloneInstance} from "galactic.ts";
// Create a standalone instance running 2 clusters with 2 shards each
const machine = new StandaloneInstance(
`${__dirname}/bot.js`, // Path to your bot entry script
2, // Number of clusters
2, // Shards per cluster
process.env.TEST_SA_BOT_TOKEN!, // Your Discord bot token
[] // Intents
);
machine.start(); // Start the standalone instance- The first argument is the path to your bot entry script.
- The second argument sets the number of clusters, and the third sets shards per cluster.
- Pass your Discord bot token, and optionally extra arguments.
In your bot.ts, initialize the bot and handle clustering integration.
Your standalone instance will start multiple clusters and shards according to your configuration. On each restart, Galactic automatically balances the workload.
- Explore galactic bridge for distributed setups
If you have questions or want to contribute, visit GitHub discussions or the issue tracker.
