Frameworks and SSR
Use the widget from React, Vue or Svelte and render a readable initial thread on the server.
Install the SDK
Build the package in the Blua checkout. Copy the resulting .tgz to the host project and install it there. The second command assumes you copied it into the host’s vendor directory.
Shellpnpm sdk:pack
packages/embed/dist/blua-embed-0.0.0.tgz
Shellpnpm add ./vendor/blua-embed-0.0.0.tgz
React
TSXimport { BluaComments } from '@blua/embed/react';export function Discussion({ slug }: { slug: string }) { return ( <BluaComments endpoint="https://blua.example" siteKey="garden" pageKey={slug} locale="en" /> );}
Vue
Vue<script setup lang="ts">import { BluaComments } from '@blua/embed/vue';defineProps<{ slug: string }>();</script><template> <BluaComments endpoint="https://blua.example" site-key="garden" :page-key="slug" locale="en" /></template>
Svelte
Svelte<script lang="ts"> import BluaComments from '@blua/embed/svelte'; let { slug }: { slug: string } = $props();</script><BluaComments endpoint="https://blua.example" siteKey="garden" pageKey={slug} locale="en" />
SSR
Read the public bootstrap on the server and pass it to an adapter’s bootstrap prop. Readers receive an HTML list and the widget reuses its data on hydration. For a server template that emits HTML directly, use the following helper.
TypeScriptimport { createBluaApiClient, renderBluaCommentsSsr } from '@blua/embed';export async function renderDiscussion(slug: string) { const props = { endpoint: 'https://blua.example', siteKey: 'garden', pageKey: slug }; const bootstrap = await createBluaApiClient(props).bootstrap('newest'); return renderBluaCommentsSsr({ ...props, bootstrap, locale: 'en' });}
Load the gateway’s embed.js on the page for interactivity. Shared HTML caches should contain only public comments. Keep author-only pending posts, account sessions and site credentials in private responses.