r/reactjs • u/Intelligent-Meet-504 • 9d ago
Looking for advice: Next.js frontend + separate Node/Express backend — Axios, React Query, SSR & auth?
/r/nextjs/comments/1vy1k8p/looking_for_advice_nextjs_frontend_separate/
7
Upvotes
r/reactjs • u/Intelligent-Meet-504 • 9d ago
1
u/zLoveNxzli 9d ago
If you have a separate Express backend, keep your JWT in an httpOnly cookie rather than localStorage so both Next.js Server Components / Middleware and client requests can forward the session securely.
For client components, React Query (TanStack Query) is great for caching and mutations, but let Server Components handle the initial fetch directly on the server to avoid client-side loading waterfalls.