---
title: "Frameworks and SSR"
description: "Use the widget from React, Vue or Svelte and render a readable initial thread on the server."
---

> Documentation Index
> Fetch the complete documentation index at: https://blua.pwp.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Frameworks and SSR

## 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.

```sh
pnpm sdk:pack
```

`packages/embed/dist/blua-embed-0.0.0.tgz`

```sh
pnpm add ./vendor/blua-embed-0.0.0.tgz
```

## React

```tsx
import { 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.

```ts
import { 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.

Source: https://blua.pwp.sh/docs/en/embed/frameworks/
