RSC Boundary

API reference

Pick the entry point for your stack. The primary integration is RscBoundaryProvider. Each adapter package re-exports shared types and RscServerBoundaryMarker from @rsc-boundary/core.

 
import {
  RscBoundaryProvider,
  RscDevtoolsNext,
  nextAdapter,
  RscServerBoundaryMarker,
  SERVER_BOUNDARY_DATA_ATTR,
  COLORS,
  LABEL_BASE_STYLES,
} from "@rsc-boundary/next";

RscBoundaryProvider

Server Component. Wrap children once at the root (Next.js: app/layout.tsx; TanStack Start: app/routes/__root.tsx).

PropTypeDescription
childrenReactNodeYour app tree.

Behavior

  • Development, default: children + floating devtools.
  • Production: children only; devtools are not mounted (no client chunk for the tool).

nextAdapter / startAdapter

Each implements FrameworkAdapter from @rsc-boundary/core: DOM root selection, framework-internal filtering, and wiring for the fiber walk. You rarely import these unless you are composing RscDevtools from core yourself.

  • nextAdapter — exported from @rsc-boundary/next.
  • startAdapter — exported from @rsc-boundary/start.

RscServerBoundaryMarker

Server Component. Optional marker that injects data-rsc-boundary-server onto its single child element so devtools list the subtree as an explicit server region with your label. It uses an asChild-style pattern — it does not render a wrapper element, so your DOM structure is unchanged.

Production: the marker is a pass-through. No cloning, no attribute, no extra DOM — leaving a marker in a production build has zero impact on the shipped HTML or CSS.

Requirements: pass a single React element as children. For reliable detection prefer a host element (e.g. <section>, <div>); custom components only propagate the attribute if they spread unknown props onto their root DOM node.

Constant SERVER_BOUNDARY_DATA_ATTR is data-rsc-boundary-server if you need it for docs or codegen.

RscDevtoolsNext / RscDevtoolsStart

Client Components. Each renders the shared RscDevtools UI from core with the matching adapter pre-wired (no props). Normally you do not import them — RscBoundaryProvider mounts the right one in development. They are exported for custom layouts or non-standard wiring.

createRscBoundaryProvider

Factory from @rsc-boundary/core, re-exported by @rsc-boundary/next and @rsc-boundary/start. It takes a no-props client devtools component that closes over your adapter and returns a server RscBoundaryProvider. The published Next.js and Start packages use this internally; use it when building a new framework adapter.

Legacy rsc-boundary package

The unscoped rsc-boundary package on npm is deprecated and no longer published from this repository. Use @rsc-boundary/next or @rsc-boundary/start instead (each includes @rsc-boundary/core as a dependency).

Next-only: COLORS, LABEL_BASE_STYLES

Re-exported from @rsc-boundary/next for building static previews that match devtools styling (e.g. documentation sites). Not exported from @rsc-boundary/start; import from @rsc-boundary/core if you need them outside Next.