---
name: bijection-persistent-text-streaming
description: "Evaluate and integrate the Persistent Text Streaming component with Bijection."
---

# Persistent Text Streaming

Persisted text streaming

- Package: @bijectionhq/persistent-text-streaming
- Category: Collaboration
- Status: Preview
- License: Apache-2.0
- Bijection source (repository access required): https://github.com/bijectionhq/persistent-text-streaming/tree/17887b3dd8a19ed5db576acf592cca0adcef2d03
- Upstream: https://github.com/convex/persistent-text-streaming/tree/4154ffd3463948d70da62327592d1c49883cf8ba
- Documentation: https://docs.bijection.com/components/using
- Directory: https://bijection.com/components/persistent-text-streaming

## Get the source

Bijection repository access is required. Request access at https://bijection.com/contact.

```sh
git clone https://github.com/bijectionhq/persistent-text-streaming.git
cd persistent-text-streaming
git checkout 17887b3dd8a19ed5db576acf592cca0adcef2d03
```

## Before using this component

Read the package README at the recorded revision for setup, dependencies, and API examples. Upstream documentation describes the original package and may differ from the Bijection adaptation. This is a source candidate for evaluation. Catalog inclusion does not establish npm availability or runtime qualification. Check compatibility with your SDK and deployment before adoption. External providers run their own compute.

## Integration workflow

1. Read the source README and package manifest at the recorded revision.
2. Confirm the required SDK, dependency availability, and runtime compatibility.
3. Follow the component's documented setup and configuration. Never invent an npm install command from a catalog package name.
4. Keep credentials in the project's existing secret store.
5. Follow the project's execution rules for verification and report what was actually checked.

## Original upstream skill

The following guidance describes @convex-dev/persistent-text-streaming. Its installation commands and APIs refer to the upstream package. Evaluate compatibility with the Bijection source separately.


> Agents: read this skill fully before writing code that uses Persistent Text Streaming. Follow the installation and configuration steps exactly.

# Persistent Text Streaming

## Instructions

This component combines HTTP streaming with database persistence to deliver real-time text updates while storing content permanently. It provides a React hook that streams text from HTTP actions while simultaneously persisting chunks to the database at sentence boundaries. Developers get low-latency streaming for the original client plus durable storage accessible by other users or after reconnection.

### Installation

```bash
npm install @convex-dev/persistent-text-streaming
```

Current npm version: `@convex-dev/persistent-text-streaming@0.3.5`

## Use cases

- **Building AI chat applications** where you want users to see tokens streaming in real-time but also need conversations persisted for chat history and sharing
- **Creating collaborative writing tools** where one user generates content that streams live to collaborators while being saved incrementally to the database
- **Implementing live transcription features** where audio is converted to text in real-time, streamed to the UI, and stored for later retrieval and searching
- **Building code generation interfaces** where AI-generated code streams to the developer while being saved to project files or revision history
- **Creating real-time document summarization** where large documents are processed and summaries stream to users while being persisted for team access

## How it works

The component exposes a `PersistentTextStreaming` class that manages stream lifecycle through `createStream()` and `getStreamBody()` methods. Developers create streams in mutations, then use HTTP actions with the `stream()` method to generate and append text chunks via a provided `chunkAppender` callback function.

On the frontend, the provided React hook `useStream()` connects to both the HTTP streaming endpoint and a Convex query simultaneously. The hook displays real-time tokens from the HTTP stream while the database receives updates at sentence boundaries, balancing performance with persistence.

Integration requires installing the component via `app.use()` in `convex.config.ts`, creating HTTP routes for streaming endpoints, and using the React hook with your streaming URL and query function. The component handles CORS headers and manages the connection between ephemeral HTTP streams and durable database storage.

## When NOT to use

- When a simpler built-in solution exists for your specific use case
- If you are not using Convex as your backend
- When the functionality provided by Persistent Text Streaming is not needed

## Resources

- [npm package](https://www.npmjs.com/package/%40convex-dev%2Fpersistent-text-streaming)
- [GitHub repository](https://github.com/convex/persistent-text-streaming)
- [Convex Components Directory](https://www.convex.dev/components/persistent-text-streaming)
- [Convex documentation](https://docs.convex.dev)