LittleSpace Network Developers
Sign in

Other Fluxer instances

Fluxer can be self-hosted, so there are many instances besides littlespace.chat. fluxkit works with any of them. Change instance and nothing else:

JavaScript
const bot = new FluxerClient({ instance: 'https://fluxer.app', token });

#How fluxkit finds the API

Each instance publishes its addresses at /.well-known/fluxer. fluxkit reads that when the bot logs in and uses the API and gateway addresses it lists, so it works no matter how an instance is set up.

You can look at what an instance publishes yourself:

JavaScript
import { discover } from '@littlespace/fluxkit';

const info = await discover('https://littlespace.chat');
console.log(info.api, info.gateway);

#One token per instance

A bot account belongs to one instance. To run the same bot on two instances, create an application on each and run one FluxerClient per token:

JavaScript
const home = new FluxerClient({ instance: 'https://littlespace.chat', token: process.env.LS_TOKEN });
const main = new FluxerClient({ instance: 'https://fluxer.app', token: process.env.FLUXER_APP_TOKEN });

for (const bot of [home, main]) bot.command('ping', ({ reply }) => reply('pong!'));
await Promise.all([home.login(), main.login()]);