FluxyChat

Ecosystem & CLI

Svelte quickstart

Use FluxyChat in Svelte 5 with the useChat store helper.

Install the Svelte package and the core SDK:

npm install @fluxy-chat/svelte @fluxy-chat/sdk

Minimal example:

<script lang="ts">
  import { useChat } from '@fluxy-chat/svelte';
  import { FluxyChatClient } from '@fluxy-chat/sdk';

  const client = new FluxyChatClient({
    baseUrl: import.meta.env.VITE_FLUXYCHAT_WORKER_URL,
    userId: 'user-1',
    token: import.meta.env.VITE_MEMBER_JWT,
  });

  const chat = useChat({ roomId: 'room-demo', client });
</script>

{#if $chat}
  <p>Messages: {$chat.messages.length}</p>
{/if}

useChat returns a Svelte readable store with the full room snapshot (messages, connection state, send helpers).