bun-react-ssr

Build server-rendered React applications with Bun using streaming SSR and hydration.

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/aicodepro/ai-agent-nexi --skill bun-react-ssr-aicodepro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bun-react-ssr
Source: https://github.com/aicodepro/ai-agent-nexi/tree/main/agent/skills/bun-react-ssr
Command: npx skills add https://github.com/aicodepro/ai-agent-nexi --skill bun-react-ssr-aicodepro

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires react, react-dom, and includes references (resource) components.

What problem does it solve? Setting up server-side rendering for React without a framework requires wiring together server entry points, client hydration, bundling, and streaming manually, which is error-prone and time-consuming. ## Core Features & Use Cases - Custom SSR Server: Render React components to HTML strings or streams with Bun.serve and react-dom/server. - Streaming SSR with Suspense: Use renderToReadableStream with Suspense boundaries for progressive page delivery. - Client Hydration & Bundling: Hydrate with hydrateRoot and bundle the client entry using Bun.build with code splitting and minification. - Use Case: Build a lightweight server-rendered React site with server-side SQLite data fetching, initial data injection via window.INITIAL_DATA, and a production build pipeline without adopting Next.js. ## Quick Start Ask the AI to scaffold a Bun server-rendered React app with a streaming server entry, client hydration, and a production build script.

Frequently Asked Questions about bun-react-ssr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I server-render React with Bun without Next.js?

Use Bun.serve with renderToString from react-dom/server to render your App component to HTML, wrap it in an HTML document, and return it as a Response. Serve a client bundle built with Bun.build and hydrate it with hydrateRoot on the client.

How to use streaming SSR with React and Bun?

Use renderToReadableStream from react-dom/server inside a Bun.serve fetch handler and return the stream as the Response body. Pass bootstrapScripts for the client bundle and await stream.allReady when you need Suspense boundaries resolved before sending.

Does Bun support React hydration after server-side rendering?

Yes, hydration works by calling hydrateRoot from react-dom/client on the root element with the same App component rendered on the server. Initial server data can be passed through a window.__INITIAL_DATA__ global injected into the HTML.

Why does hydration mismatch happen in React SSR?

Hydration mismatch occurs when the server-rendered HTML differs from what the client renders, usually due to differing initial state or browser-only APIs. Guard DOM access with typeof window checks and ensure initial data is identical on both sides.

When should I use a framework instead of custom Bun SSR?

Custom Bun SSR fits lightweight apps where you control routing, data fetching, and bundling directly. For complex routing, nested layouts, or large teams, a framework like Next.js or Remix provides conventions that manual setups lack.