Skip to content

Standalone Instance

SleepyPxnda edited this page Feb 27, 2026 · 4 revisions

Galactic Logo

Getting Started: Standalone Instance

This example shows how to launch Galactic in standalone mode, running multiple clusters and shards on a single machine for efficient scaling.

Step 1: Setup Your Entrypoint

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.

Step 2: Implement Your Bot Logic

In your bot.ts, initialize the bot and handle clustering integration.

Create bot.ts

Your standalone instance will start multiple clusters and shards according to your configuration. On each restart, Galactic automatically balances the workload.


Next Steps


If you have questions or want to contribute, visit GitHub discussions or the issue tracker.

Clone this wiki locally