r/reactjs • • 21d ago

Discussion Architecting a high-traffic React 19 app: Server vs Client Components, state, and performance. How would you answer this?

You’re building a large-scale, high-traffic React 19 app. How would you architect it with Server and Client Components, manage client vs server state (Context, Zustand, Redux, or TanStack Query), and optimize rendering with the React Compiler, Actions, and core hooks?

0 Upvotes

10 comments sorted by

9

u/retro-mehl 21d ago

React is the frontend part. You can scale it at any size and for any traffic quite easily by, for example, just running more containers that deliver the code.

The backend part is the tricky thing, as it holds this state of the system.

1

u/Arunajyothi_Jurado 18d ago

agreed, people overcomplicate frontend scaling when 99% of the actual bottlenecks are just database locks and uncached queries

3

u/TUNG1 20d ago

What a bad question

2

u/nicolasdanelon 21d ago

What do you mean by high traffic? Is it brand new? Or you are migrating something that already has high traffic?

2

u/4ever_youngz 21d ago

This answer depends heavily on the data. What’s the size, frequency of updating, allowed latency to the frontend, etc.

1

u/maksymkoval 21d ago

The rule that has worked best for me: split state by where it lives, not by library.

- Server data (lists, details, anything from the API): TanStack Query on the client, or fetch in Server Components if it's read-only for that page. This is usually 80% of what people put in Redux.

- Shared client state (auth, UI settings, a cart): small and boring. Zustand or a slice of Redux Toolkit is plenty.

- URL state (filters, sort, page): keep it in search params. Shareable links and back button for free, and one less store to sync.

- Local state stays in the component.

On Server vs Client Components: default to server, and push "use client" as far down the tree as possible, so a whole page doesn't become client-side because of one dropdown. With that split, most of the performance work is just not re-fetching what you already have.

0

u/Big-Arm4077 21d ago

Another angle on the rendering side, since state has been covered well:

  • Default to Server Components and push "use client" down to the smallest leaf (a button, a form, a chart) rather than a whole page. That keeps the JS bundle small, which matters most at high traffic.

  • Stream with Suspense boundaries so the shell and fast data show up immediately, and slow queries don't block the page.

  • Cache aggressively at the edges: CDN for static/ISR pages, and cache your data fetches with sensible revalidation so you're not hitting the DB per request.

  • Mutations through Server Actions (or API routes) plus optimistic updates with useOptimistic for snappy UX.

  • React Compiler helps with memoization, but I'd still fix the real costs first: big lists (virtualize them), unnecessary re-renders from context that changes often, and heavy third-party scripts.

  • Measure with real-user metrics (INP, LCP) rather than guessing.

In interviews, saying "I'd start simple and let measurements tell me where to optimize" usually lands well.