Skip to main content

Server Components visual mental model

Server Components change where component code executes and what crosses the server/client boundary. They are not simply another name for SSR.

Server Component → Client Component boundary
ServerServer Component executes on the server

It can use server-side data access and produce a serializable React result without shipping its component code as client JavaScript.

BoundaryClient Component receives serializable inputs

Crossing into client code creates a client module boundary. Values crossing that boundary must follow the supported serialization contract.

ClientClient Component owns browser interaction

State, event handlers, Effects, refs, and browser APIs belong in client-executed code.

SSR and Server Components answer different questions​

SSR vs RSC
SSRWhen is HTML produced?

Server rendering concerns producing initial HTML before browser interaction begins.

RSCWhere does component code run?

Server Components concern the server/client component execution model and payload boundary.

They can coexist
Server Component tree produces server-side React output
Framework/server renderer may turn initial result into HTML
Client boundaries hydrate / become interactive in the browser

'use client' marks a client module boundary​

Client boundary propagation
Server-side module graph
Client module graph begins

Imports pulled into that client entry become part of the client-side graph unless architecture separates them.

Browser bundle and interactive components

'use server' is about server-callable functions​

Do not confuse component and function directives
'use client'

Marks a client module boundary for code that must execute in the browser.

'use server'

Marks supported functions/modules as server-callable Server Functions. It is not the marker that makes a component a Server Component.

Server Functions cross a security boundary​

Server Function trust boundary
Client can request a Server Function call

Treat arguments as untrusted request input.

Validate and authorize on the server

Authentication context, authorization, validation, and safe mutation rules still apply.

Return only safe public results

Do not expose secrets, database internals, or trusted server objects across the boundary.

Choose the execution side deliberately​

Where should this responsibility live?
Needs database/filesystem/secret server accessPrefer server-side code when the framework supports it.
Needs useState, event handlers, Effects, DOM, browser APIsIt needs a Client Component boundary.
Only passes data/layout through to interactive childrenKeep the parent server-side when possible and push the client boundary down.
Needs to mutate server data from the clientUse a secure Server Function/action or HTTP endpoint with validation and authorization.
You are deciding whether HTML is generated on the serverThat is an SSR/rendering strategy question, separate from RSC.

Keep this mental model​

Server Components in one picture
Server Components keep server-only work on the server
Boundaries serialize data and define client module ownership
Client Components own browser interaction

Continue with Server Components and Client Boundaries for the detailed execution, composition, and framework integration model.