Server Components and client boundaries
React Server Components (RSC) change where component code executes. They are not simply another name for server-side rendering.
A framework can combine both:
Server Components are infrastructure-aware​
A normal client-only Vite build does not become an RSC application by importing one React API. An RSC-capable framework/bundler must understand:
- server and client module graphs;
- RSC payloads and client references;
- serialization;
- Server Functions;
- routing, data, and bundling boundaries.
Use an RSC-capable framework instead of inventing this transport inside a normal SPA build.
There is no 'use server' marker for Server Components​
'use client' is the directive that creates a client module boundary.
'use client';
import { useState } from 'react';
export default function Expandable({ children }) {
const [open, setOpen] = useState(false);
return (
<section>
<button onClick={() => setOpen(v => !v)}>Toggle</button>
{open && children}
</section>
);
}
The module graph and render tree are different​
A client module and modules it imports must be client-evaluable.
A Client Component may still receive already-rendered Server Component output as children or props.
For example, server-rendered content can be composed through an interactive client wrapper:
// Server Component
export default function Page() {
return (
<InteractivePanel>
<ServerRenderedReport />
</InteractivePanel>
);
}
The client wrapper does not need to import and execute ServerRenderedReport in the browser.
Server Components can be async​
export default async function Product({ id }) {
const product = await db.products.get(id);
return <h1>{product.name}</h1>;
}
Server Components can directly access server resources such as databases, files, internal services, and server-only SDKs—subject to your framework and runtime.
This can reduce client JavaScript, but it does not make slow queries or bad architecture disappear.
When do you need a Client Component?​
Do not mark an entire page 'use client' because one button needs state.
Serializable values cross server → client​
Anything crossing into a Client Component must fit React's supported serialization model and be safe for browser exposure.
Wrong:
<ClientPanel databaseConnection={db} apiSecret={process.env.SECRET_KEY} />
Pass the minimum safe data the browser actually needs.
Promise handoff and Suspense​
A Server Component can start work early and pass a Promise to a Client Component, where use can suspend on it.
// Server Component
export default async function Page({ id }) {
const product = await getProduct(id);
const reviewsPromise = getReviews(id);
return (
<>
<ProductDetails product={product} />
<Suspense fallback={<ReviewsSkeleton />}>
<Reviews reviewsPromise={reviewsPromise} />
</Suspense>
</>
);
}
'use client';
import { use } from 'react';
export default function Reviews({ reviewsPromise }) {
const reviews = use(reviewsPromise);
return reviews.map(review => <p key={review.id}>{review.text}</p>);
}
RSC does not eliminate APIs or client state​
Server Components can remove some browser-to-server read endpoints from a React web app's internal render path, but systems may still need APIs for mobile clients, integrations, webhooks, SDKs, and jobs.
Client state still owns browser-local interaction such as drafts, menus, drag state, optimistic projections, and media controls.
Performance and freshness still belong to architecture​
A Server Component may run at build time, per request, after revalidation, during navigation, or as part of cached work. React provides the component model; your framework defines route/cache/revalidation policy.
You can still create server waterfalls, oversized client bundles, excessive serialization, poor Suspense boundaries, and slow data access.
Security boundary​
Authorization, validation, tenant isolation, and secret handling remain backend responsibilities.
Testing strategy​
Use the layer that actually models the boundary:
- pure server helper/data-access tests;
- Server Component integration tests supported by the framework;
- Client Component interaction tests;
- end-to-end route tests for real server/client composition.
Do not force an RSC tree into a client-only harness that cannot represent the module boundary.
Common mistakes​
- treating
'use server'as a Server Component directive; - putting
'use client'at page/root level unnecessarily; - importing server-only code from the client module graph;
- passing arbitrary server objects through props;
- confusing RSC execution with SSR HTML generation;
- assuming Server Components run on every request;
- assuming RSC automatically makes an application fast.
Architecture checklist​
- Does this component need browser interaction APIs?
- Can its data read stay on the server?
- Is the client boundary as narrow as practical?
- Are all client-bound props serializable and safe to expose?
- Are server-only imports excluded from the client graph?
- Are authorization and tenant boundaries enforced where data is read?
- Does the framework's cache/revalidation policy match freshness needs?
Interview questions​
Junior: What is a Server Component?
Mid-level: What does 'use client' actually mark?
Senior: Explain the difference between the render tree and module graph, then describe how RSC, SSR, Suspense streaming, serialization, and hydration can work together on one route.