Skip to content

Self-hosting

This guide sets you up with a self-hosted Fluxcord bot.

  • A system with Docker and Docker Compose (install Docker Desktop on Windows/macOS, or Docker Engine on Linux).
  • Both Fluxer and Discord has Developer Mode enabled (go to Settings > Advanced and enable “Developer Mode”)
  1. Firstly, make a folder for Fluxcord and enter it.

    Terminal window
    mkdir fluxcord
    cd fluxcord
  2. Then, create a file called docker-compose.yml and paste this into it.

    Terminal window
    nano docker-compose.yml
    services:
    bot:
    image: git.gay/fluxcord/core:latest
    restart: on-failure
    volumes:
    - ./data:/data
    - ./config.js:/app/config.js
    expose:
    - "8080"
    healthcheck:
    test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:8080/health').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"]
    interval: 30s
    timeout: 5s
    start_period: 60s
    retries: 3
    networks:
    - fluxcord-net
    networks:
    fluxcord-net:
    driver: bridge
    name: fluxcord-net

    ./data is where the bot’s database and files live.

    ./config.js is the config file we’ll edit later.

  3. Download the example config file as config.js:

    Terminal window
    curl -o config.js https://git.gay/Fluxcord/core/raw/branch/main/config.example.js

    Or, if you have wget:

    Terminal window
    wget -O config.js https://git.gay/Fluxcord/core/raw/branch/main/config.example.js
  1. Go to https://discord.com/developers/applications (log in if needed)
  2. Go to Applications, and create an application by clicking “New Application”.
  3. Name your bot, accept the terms, and click “Create”.
  4. Copy the Application ID. We’ll need that, then go to Bot, then click “Reset Token”. Verify your Multi-factor Authentication if needed.
  5. Copy the generated token, we’ll also need that.
  6. Scroll down and enable “Message Content Intent”.
  1. Go to Settings > Applications, and create an application by clicking “Create Application”.
  2. Name your bot, and click “Create”.
  3. Copy the Application ID. We’ll need that in the next step.
  4. Click “Reset Token”. Verify your Multi-factor Authentication if needed.
  5. Copy the generated token, we’ll need that.

Making a community for temporary emojis (Fluxer)

Section titled “Making a community for temporary emojis (Fluxer)”

This is so the bot can store temporary bridged emojis. If you want to use an existing community you can skip to step 3.

  1. Scroll all the way down the left sidebar, click the + button (Create or join a community), then click “Create Community”.
  2. Name it something, and click “Create Community”.
  3. Now, invite the Fluxer bot by using this link. Replace the [APP_ID] to the Application ID we got on the previous step.
    https://web.fluxer.app/oauth2/authorize?client_id=[APP_ID]&scope=bot&permissions=2260735261797440
    If you’re pointing the bot at a self-hosted Fluxer instance, replace web.fluxer.app with your instance’s address.
  4. After that, right click the community and click “Copy Community ID”
  1. Firstly, open the config file.
    Terminal window
    nano config.js # or vi, gedit, kwrite, emacs...
  2. Then, fill in the values you got from the previous steps.
    DiscordBotToken: "...", // Discord bot token
    DiscordClientId: "...", // Discord Application ID
    FluxerBotToken: "...", // Fluxer bot token
    FluxerTempEmojiGuildId: "...", // temporary emoji community ID
  3. Add your Discord and Fluxer accounts on the Admin account IDs by right clicking your user and click “Copy User ID”, then pasting it on the AdminAccountIds field.
    AdminAccountIds: ["YOUR_DISCORD_ID", "YOUR_FLUXER_ID"],

Fluxcord uses SQLite by default, which is fine for almost everyone. To use PostgreSQL instead, set PostgresConnectionString:

PostgresConnectionString: "postgres://user:password@host:5432/fluxcord",

DatabaseEncryptionToken only applies to SQLite and is ignored when Postgres is set. Migrations run automatically on start.

To move existing SQLite data into Postgres:

Terminal window
docker compose exec bot pnpm run migrate:to-postgres

If your bot bridges to a self-hosted Fluxer instance instead of fluxer.app, do this when editing the config file:

  1. Firstly, open your config.js:
    Terminal window
    nano config.js # or vi, gedit, kwrite, emacs...
  2. Then, point the bot at your instance:
    FluxerAPIBaseURL: "https://example.com/api",
    Make sure the Fluxer bot token, Application ID, and temporary emoji community all come from your instance as well.
  3. If you use voice bridging later, make sure the voice runner can reach your instance’s LiveKit URL. The runner gets the LiveKit address from your Fluxer server, so make sure that is accessible to the bot.
  1. Run the bot.
    Terminal window
    docker compose up -d
    The image is pulled automatically, and migrations run on first start.
  2. To see logs, just run
    Terminal window
    docker compose logs -f
Terminal window
docker compose pull
docker compose up -d --force-recreate

This downloads the newest image and restarts the bot.

To check whether new settings were added:

Terminal window
curl -o config.example.js https://git.gay/Fluxcord/core/raw/branch/main/config.example.js

Or, if you have wget:

Terminal window
wget -O config.example.js https://git.gay/Fluxcord/core/raw/branch/main/config.example.js
Terminal window
diff config.example.js config.js

You don’t need to open any ports. Fluxcord only makes outbound connections to Discord and Fluxer.

  • 8080 is the healthcheck endpoint (/health). It’s only reachable inside Docker; to view it from the host, add this to the bot service:
    ports:
    - "8080:8080"
  • 8765 (RunnerWsPort) is used between the bot and the voice runner. Keep it internal. Only publish it if the voice runner runs on a different server.

The bot will output the invite links on the log/console. Those are the invite codes you use to invite the bot to your server.

After that, go to Getting Started and follow steps 2-4.

If you want voice bridging, follow the Self-hosting voice guide after the bot is running.

To run the bot and the voice runner together from one file, use this docker-compose.yml instead:

services:
bot:
image: git.gay/fluxcord/core:latest
restart: on-failure
volumes:
- ./data:/data
- ./config.js:/app/config.js
networks:
- fluxcord-net
voice:
image: git.gay/fluxcord/voice:latest
restart: unless-stopped
environment:
- CORE_WS_URL=${CORE_WS_URL:-ws://bot:8765}
- RUNNER_SECRET=${RUNNER_SECRET:-}
- RUNNER_REGION=${RUNNER_REGION:-}
networks:
- fluxcord-net
networks:
fluxcord-net:
driver: bridge
name: fluxcord-net

The bot’s service is named bot here, so the voice runner reaches it at ws://bot:8765. Create a .env file next to it with the same secret you’ll put in config.js:

RUNNER_SECRET=your-long-random-secret

Then enable voice in config.js and start everything (the Self-hosting voice guide covers the rest).