Registry / web-framework / react-server-dom-bun

react-server-dom-bun

JSON →
library0.0.0-experimental-603e6108-20241029jsnpmunverified

This package provides experimental bindings for React Server Components (RSC) specifically targeting the DOM environment and leveraging the Bun runtime. It is *not* designed for direct consumption by application developers, but rather as an internal utility for meta-frameworks to integrate RSC functionality. Being `0.0.0-experimental`, its API is highly unstable and subject to frequent changes, as evidenced by recent releases focusing on Denial-of-Service (DoS) mitigations, cycle protections, and general hardening. It is part of the broader React ecosystem, maintained by Facebook, and its release cadence is tied to React's experimental and canary channels. This means frequent, often internal-facing updates rather than strict semantic versioning, reflecting its role in cutting-edge React development. Key differentiators include its tight integration with Bun for performance and its essential role in enabling full-stack React Server Components rendering paradigms, bridging the server and client in a web application.

npm install react-server-dom-bun
INSTALL
IMPORT
SIG · REACT-SERVER-DOM-B
R
react-server-dom-bun
web-frameworkjavascriptv0.0.0-experimental-603e6108-20241029
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

renderToReadableStream
import { renderToReadableStream } from 'react-server-dom-bun/server';
const { renderToReadableStream } = require('react-server-dom-bun/server');
Used by meta-frameworks to render React Server Components to a stream on the server. The package is not for direct application use.
decodeReply
import { decodeReply } from 'react-server-dom-bun/client';
import { decodeReply } from 'react-server-dom-bun';
Intended for internal use by meta-frameworks to parse client-to-server communication for Server Actions. Note the `/client` subpath.
createFromReadableStream
import { createFromReadableStream } from 'react-server-dom-bun/client';
import { createFromReadableStream } from 'react-server-dom-bun/server';
Used internally by meta-frameworks on the client-side to hydrate React Server Components from a readable stream. Requires the `/client` subpath.

Illustrates how a meta-framework might internally use `renderToReadableStream` to serve a React Server Component with Bun. Not intended for direct app use.

import { renderToReadableStream } from 'react-server-dom-bun/server'; // IMPORTANT: This package is NOT for direct application use. // This quickstart demonstrates how a meta-framework *might* internally // use react-server-dom-bun to render a React Server Component. // Assume a simple Server Component for demonstration function App() { return ( <html> <head> <title>Bun RSC Demo</title> </head> <body> <h1>Hello from React Server Component on Bun!</h1> <p>Current time: {new Date().toLocaleTimeString()}</p> </body> </html> ); } // A simplified Bun server implementation for illustration purposes. // In a real meta-framework, this would be part of a much larger setup. const server = Bun.serve({ port: 3000, async fetch(req: Request) { const url = new URL(req.url); if (url.pathname === '/') { const stream = await renderToReadableStream(<App />); return new Response(stream, { headers: { 'Content-Type': 'text/html' } }); } // Serve static assets (e.g., a client bundle if one existed) if (url.pathname.startsWith('/src')) { try { const filePath = `.${url.pathname}`; return new Response(Bun.file(filePath)); } catch (error) { console.error(`Error serving static file: ${url.pathname}`, error); return new Response('Not Found', { status: 404 }); } } return new Response('Not Found', { status: 404 }); }, }); console.log(`Bun Server Components server running on http://localhost:${server.port}`);
Debug
Known issues
breakingThis package is explicitly marked `0.0.0-experimental`. Its API is highly unstable, subject to frequent breaking changes, and not guaranteed to maintain backwards compatibility.
fix
Avoid direct reliance on this package for application-level code. Treat it as an internal implementation detail for meta-frameworks only.
affects: >=0.0.0-experimental-0
gotchaThe package description explicitly states: 'It is not intended to be imported directly.' Application developers should not use this package, but rather consume its functionality indirectly through a meta-framework that integrates React Server Components.
fix
If you are not building a meta-framework, use a framework like Next.js, Remix, or others that provide React Server Components integration out-of-the-box.
affects: >=0.0.0-experimental-0
breakingRecent releases include critical security and stability patches, such as 'DoS mitigations to Server Actions' and 'cycle protections'. This indicates that previous experimental versions may have had vulnerabilities or instability, which are actively being addressed.
fix
Meta-frameworks should ensure they are using the absolute latest experimental versions of `react-server-dom-bun` to benefit from the most recent security and stability improvements.
affects: <=19.2.4
gotchaThis package is specifically designed for the Bun runtime. Attempting to use it in Node.js or other JavaScript runtimes is unlikely to work correctly and may lead to runtime errors or unexpected behavior.
fix
Ensure your project is configured to run with Bun if you are developing or testing a meta-framework that utilizes `react-server-dom-bun`.
affects: >=0.0.0-experimental-0
Errors
Common errors & fixes
Error: This package is experimental and not intended for direct use.
Attempting to import or use `react-server-dom-bun` directly in an application, rather than through a meta-framework.
fix
Integrate React Server Components via a supported meta-framework (e.g., Next.js, Remix) that handles this package internally.
TypeError: (0, _react_server_dom_bun_server__WEBPACK_IMPORTED_MODULE_0__.renderToReadableStream) is not a function
Incorrect import path for ESM or CJS, or attempting to use a function that is not exported or available in the specific runtime environment or subpath.
fix
Verify the correct import path (`/server` or `/client` subpath) and ensure your bundler/runtime correctly handles ESM imports from `react-server-dom-bun`.
Invariant Violation: React Server Components require a Bun runtime.
Attempting to run code using `react-server-dom-bun` in a non-Bun environment (e.g., Node.js, Deno).
fix
Ensure your server-side rendering environment is configured to use the Bun runtime for projects leveraging this package.
Upgrade
Version history
0.0.0-experimental-603e6108-20241029latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
react-server-dom-bun — npm install react-server-dom-bun · libregistry