Providers

Mount the providers in your root +layout.svelte and every rune state class below picks them up via context. Two separate trees so you can mount either or both. They don't share state.

CStarLibraryProvider

src/routes/+layout.svelte
<script>
  import { CStarLibraryProvider } from '@cstar.help/svelte';
  let { children } = $props();
</script>

<!-- Seeded with a test key (cstar seed)? Add publishableKey="pk_test_..." to read test articles. -->
<CStarLibraryProvider teamSlug="acme">
  {@render children()}
</CStarLibraryProvider>

CStarChatProvider

src/routes/+layout.svelte
<script>
  import { CStarChatProvider } from '@cstar.help/svelte';
  let { children } = $props();
</script>

<CStarChatProvider teamSlug="acme">
  {@render children()}
</CStarChatProvider>

Stack both

src/routes/+layout.svelte
<!-- Seeded with a test key (cstar seed)? Add publishableKey="pk_test_..." to read test articles. -->
<CStarLibraryProvider teamSlug="acme">
  <CStarChatProvider teamSlug="acme">
    {@render children()}
  </CStarChatProvider>
</CStarLibraryProvider>

SSR

Both providers are SSR-safe: they skip the realtime/subscription wiring during server render. See the SSR safety page for the full story.

Next up