Next.js: where should the client boundary begin?
Build a product page that keeps data access on the server and interaction close to the user.
Start with the interaction
Imagine a print-order page: it displays document information and lets someone choose a quantity. In the App Router, pages and layouts are Server Components by default. Keep the data-loading page on the server and move the quantity selector into a small Client Component. That boundary follows a useful product distinction: reading an order and editing a quantity are separate responsibilities.
Make the boundary explicit
A component using state or browser events needs a client boundary. The use client directive also brings its imported component dependencies into the client module graph. Give the selector only the data it needs, using serializable props; keep database access and secrets in server-only code.
// Quantity.tsx
'use client';
import { useState } from 'react';
export function Quantity() {
const [count, setCount] = useState(1);
return (
<button onClick={() => setCount(count + 1)}>
Copies: {count}
</button>
);
}Check the result
Review the component tree when adding interaction. Does a new button require the whole page to become a Client Component? Usually the button can own that interaction. A final order submission still needs server-side validation: a displayed quantity or price is input, not proof that an order is valid.
Sketch the page before splitting files
For a print checkout, draw three regions: document summary, quantity control, and order submission. The summary needs database information; the quantity control needs state; the submission needs a trusted server decision. Write those responsibilities beside the sketch. Then give the client control a document identifier and any display values it needs. This makes the file boundary explainable to someone reviewing the feature. If the control starts requesting customer records it never displays, revisit its input contract before adding more props.
Design the server response for the screen
A database record and a view model serve different purposes. An order row might contain internal notes, storage keys, and operational flags, while the page only needs a title, status, and public identifier. Build a small object for that screen. Avoid passing a large record simply because it is convenient today. This also makes the interaction easier to demonstrate with fixture data: the quantity component can render without knowing how the database query was written. Keep money calculations on the server when an order is placed.
A practical review before shipping
Walk through the page with three inputs: a valid order, an unavailable document, and an invalid quantity. Give each case an explicit visible outcome. Refresh a populated page and check for hydration warnings. Review the browser bundle when introducing a large dependency, and inspect the network request when submitting the form. A small client boundary is useful only if the complete experience still handles loading, errors, and keyboard interaction. The goal is a reliable feature with understandable responsibilities, not the smallest possible number of Client Components.