Next 15 Data Fetching: Best Practices for a Large App?

Hey everyone, doing a quick sanity check on our data fetching strategy for a large Next.js 15 app in production. Current Stack: React Query + Server Actions We're running into a few challenges and would love this community's opinion on the best path forward. Our Pain Points: - Error Handling: Errors thrown from our Server Actions are generic ("An error occurred in the Server Components render..."). How are you cleanly surfacing specific errors on the client? - Scalability: As the app grows, managing query keys and hooks is getting complex. Are there better patterns for keeping this organized at scale? - Server Actions vs. Route Handlers: Is there a clear winner for mutations when using React Query? The developer experience with errors in Server Actions has been rough. Our goal is a scalable and reliable data-fetching layer. We're open to migrating off React Query entirely if a more modern or better-integrated solution exists. What's your take? And if you have any go-to resources (articles, talks, repos) for large-scale Next.js data fetching, please send them our way.
1 Reply
.361 °
.361 °3mo ago
@daishoarch you can do like this to troubleshoot: - use try-catch statements in server actions area and serialize custom error obj manually, then capture and parse it on client side. You will see the exact reason immediately - Use pre defined custom query key and hooks for your querying. so that after your app grow, you can still touch and refactor easily data. - Use Server Actions for simple, local state updates and Route Handlers for major data mutations that need good error tracing. I did actually when touching gov university data processing.There were a bunch of data to be processed and touch variaty of industries with that. To make easier for complex logic, your answer is mandatory

Did you find this page helpful?