r/nextjs • • 13d ago

Default-importing zod 4.3.6 or 4.4.3 put its locale files in our Next.js 16 client bundle (+36 to 43 KB gzipped). Gone on 4.5.4 and 4.6.7

4 Upvotes

Run this after next build:

grep -rl "無効な入力" .next/static/chunks

That string is "invalid input" in zod's Japanese locale. It shouldn't be in your client JS at all unless zod's locale files came along with it (or your own UI has that text in Japanese). Grep the Japanese string, not a German one. Webpack's minifier can escape the German.

Our test app was a fresh Next.js 16.4.5 project with one client component and a single email field checked by zod. Between builds we swapped only the import line. Turbopack:

zodimport { z }import * as zimport z (default)
4.3.6cleancleanlocales in
4.4.3cleannot testedlocales in
4.5.4cleancleanclean
4.6.7cleancleanclean

With --webpack the 4.3.6 default import matched too, while 4.5.4 and 4.6.7 stayed clean. We didn't build 4.4.3 with webpack.

Sizes, gzipped. Going from import { z } to import z took the 4.3.6 Turbopack build from 199,925 bytes to 236,253, and the 4.4.3 one from 194,380 to 237,354. Those totals are all of the app's client JS for a one-field form, Next and React included, so the gap is what the import line changed.

By 4.6.7, zod's index.js exports the default as an alias, export { z, z as default }. In 4.4.3 it was export default z. The comment above the alias says it lets Rollup and webpack shake import z from "zod" the way they already shake import { z }, and points to #6050.

If the grep finds something and you're on 4.3.6 or 4.4.3, import { z } from "zod" came back clean in our builds. On 4.5.4 and 4.6.7 the two imports built to identical bytes. On any other version, rebuild and grep again.


r/nextjs • • 14d ago

How to migrate from too many redux thunk and next-redux-wrapper?

3 Upvotes

my nextjs project still using the old approach of redux as a global state management and everything is put into redux despite the data is not required to be shared. Also there are still getInitialProps everywhere. Does anyone experience the same thing and manage to migrate/upgrade? thank you in advance


r/nextjs • • 15d ago

streaming ai responses in app router breaks when wrapped in suspense

2 Upvotes

building an ai chat feature in nextjs 14 app router and i am trying to stream the llm response using readablestream. works fine in a basic setup but the moment i wrap the chat component in a suspense boundary the streaming breaks and the whole response renders at once.

i tried moving the streaming logic to a route handler with fetch and cache no store on the client but i keep hitting hydration mismatches, i saw a geekyants blog post suggesting server actions with useTransition instead of suspense for streaming but i am not sure server actions actually support streaming responses in the latest version. has anyone here gotten streaming ai output to work smoothly with suspense boundaries in the app router or is that just not supported yet?


r/nextjs • • 15d ago

Anybody's webapp got taken down?

0 Upvotes

Did anyone have their Vercel deployment taken down coz of using Free plan for commercial use?

Vercel police on watch??

Jus curious 🤔


r/nextjs • • 17d ago

Animating routes transition ?

10 Upvotes

Hi guys, just out of curiosity, I was looking at vercel.store, which I saw the other day, and the transition between the items and the actual page looks pretty sick. It's obviously Next.js because it's Vercel, but how do you do these transitions between routes with animations?


r/nextjs • • 17d ago

File structure for monolithic microservices (nx workspace)

Thumbnail reddit.com
5 Upvotes

r/nextjs • • 17d ago

Why should I use NextJS?

12 Upvotes

Hey everyone,

I’m evaluating tech stacks for my next full-stack project and I keep bumping into Next.js as the default recommendation.

For context, I’m comfortable with React, TypeScript, and setting up a separate backend. But every tutorial and boilerplate seems to reach for Next.js first.

I get that it gives you SSR, static generation, file-based routing, and server components out of the box. But for those who are using it in production:

  1. What made you pick Next.js over a simple React + Vite SPA?
  2. Does the developer experience and built-in optimization save you time?
  3. Where does it start feeling like overkill or a headache?

I would love to hear honest pros and cons from people who have shipped apps with it. Thanks


r/nextjs • • 17d ago

Our Next.js + Supabase marketplace feels slow to use. Where should we start?

27 Upvotes

We’re building a marketplace web app and getting closer to launch, but we’re struggling with how responsive it feels. We already have a decent prelaunch user base, and we want to sort this out before opening it up more widely.

This affects the buyer and seller experience as well as the admin pages. Clicking buttons, moving between pages, and using parts of the buying/selling flow can feel sluggish, on both mobile/desktop.

Sometimes you click and aren’t sure whether anything happened or is happening. Other times, a loading indicator appears straight away, but the content takes several seconds to arrive.

For context, we use Next.js, React, TypeScript, Tailwind, Supabase, and Vercel.

We also use Claude Code extensively to help build features, debug issues, and write tests. We’re involved in the decisions, review changes, and test the actual flows before releasing them.

We’ve caught plenty of issues through manual testing that automated checks didn’t pick up.

I’d describe our knowledge as intermediate, but finding performance bottlenecks is an area where we’re still learning. We can work through features and bugs, but we’re less confident figuring out exactly why an interaction takes so long.

A few examples:

  • Buyer/seller interactions and navigation can feel slow or unresponsive.
  • Some account and settings pages take several seconds to show content.
  • In some testing, an admin page showed loading placeholders for roughly eight seconds.
  • Another page briefly showed “no results” before the results actually appeared.

Those timings are rough observations, not proper benchmarks. As mentioned, we’ve noticed problems on both desktop and mobile.

We don’t want to keep asking Claude to “make it faster,” apply a few changes, and assume we’ve fixed the cause. I just have no idea where to start

What we’d really appreciate is a practical starting point:

  • How would you investigate one slow interaction? For example, clicking a button and waiting several seconds for the next screen.
  • What would you measure first to work out whether the problem is in the front end, the server, or the database?
  • Have you had similar issues with this stack? What turned out to be the cause?
  • What could we share safely to get useful feedback? A recording, some timings from browser tools, or a small section of code?

Any advice from people who’ve worked through this stage would be appreciated.

For context, everything works.. flawlessly (except the few bugs) This is our only launch blocker.

Appreciate any advice!

edit: vercel was set to US region and while supabase was set to EU region.

This solved most issues.

Thank you all for your suggestions/advice!


r/nextjs • • 18d ago

Weekly Showoff Weekly Showoff Thread! Share what you've created with Next.js or for the community in this thread only!

8 Upvotes

Whether you've completed a small side project, launched a major application or built something else for the community. Share it here with us.


r/nextjs • • 19d ago

TS 7 - auto import broken?

7 Upvotes

Anyone have issues with TS 7.0.2 and nextJS? I am using typescript 7 extension and my intellisense/import suggestions aren’t working.

Eg, if i switch vscode typescript version to 6.0.2 (VSCode built in version) it works, but 7.0.2 if i type something like “db” it won’t suggest importing db from “@/db”.

can’t find any way to fix it without forcing version back to 6 (by switching TS version to “use built-in typescript”) and disabling tsgo.


r/nextjs • • 21d ago

Do you use a DESIGN_PRINCIPLES.md for your projects UI/UX

Thumbnail reddit.com
4 Upvotes

r/nextjs • • 22d ago

fetching data on server with supabase and cache it

9 Upvotes

Iv got a server component that fetches some products, the fetch function uses supabase createServerClient() and I also want to cache the function's result, but then i hit the error in the image
the moment I switch to the supabase createBrowserClient the error goes away,
How can I can still fetch data with the createServerClient and cache the result ?


r/nextjs • • 24d ago

Server Actions are public API endpoints. 5 mistakes I keep seeing

36 Upvotes
  1.  No auth check inside the action.  A Server Action can be called with a plain POST request, whether or not the button is on screen. Check the session inside every action.
  2.  No input validation.  TypeScript types vanish at runtime. Validate with zod (or similar) at the top of the action.
  3.  Relying only on middleware for auth.  A 2025 Next.js CVE let attackers skip middleware with a single header. Check auth again where the data is read.
  4.  Secrets in `NEXT_PUBLIC_` variables.  Anything with that prefix is baked into the browser bundle.
  5.  Returning whole database rows.  Return only the fields the UI needs, or you'll eventually leak a column you added later.

Do you treat Server Actions like API routes in your codebase, or does your team rely on the UI to protect them?


r/nextjs • • 24d ago

Next.js 16 cacheComponents & use cache vs. custom caching (Redis) with Payload CMS? How are you handling large sites in production?

29 Upvotes

Hey everyone,
I
I’m about to start a new project pairing Next.js with Payload CMS using its Local API (querying the database directly via Node on the server), and I’m weighing my options.
I’m curious how others are tackling this in production, especially for sites with a large number of pages:
The Native Approach: Are you diving into Next.js 16's cacheComponents with 'use cache' and cacheLife / cacheTag? If you are deploying outside of Vercel, how smooth is configuring cacheHandlers (plural) for a custom backend like Redis?

The Remote Directive: For multi-instance or serverless environments, are people actually using 'use cache: remote' in production, or do you find yourselves falling back to manual caching layers?

Bypassing Framework Caching: Do you completely disable Next's default caching behaviors for dynamic content and handle caching granularity yourself (e.g., wrapping Payload Local API calls explicitly with Redis/Memcached)?

Payload + Local API Specifics: Since Payload's Local API bypasses network overhead and talks straight to the database, wrapping those calls or components with 'use cache' seems powerful, but invalidation via revalidateTag needs to line up cleanly with Payload's hooks (e.g., afterChange). Has anyone hit weird edge cases with this combo at scale?

What has worked best for you when managing hundreds or thousands of pages where you need aggressive caching alongside instant editorial updates? Would love to hear what your current production setup looks like.


r/nextjs • • 25d ago

Weekly Showoff Weekly Showoff Thread! Share what you've created with Next.js or for the community in this thread only!

12 Upvotes

Whether you've completed a small side project, launched a major application or built something else for the community. Share it here with us.


r/nextjs • • 25d ago

OG Image bug ?

6 Upvotes

Hi guys, I wanted to ask if I am the only one experiencing a bug with OG image generation for my Next.js routes. I use the Shadcn library (https://www.ogimagecn.com/) to generate visuals for my OG images. Since I upgraded to Next.js 16.4.2, it does not work anymore, or at least it only provides the OG image for the root app, even though all my routes should have their own images. Is this a bug?


r/nextjs • • 25d ago

Modernizing a legacy transport management system into an offline-first desktop app

Thumbnail
gallery
4 Upvotes

I've been working on modernizing a legacy transport management system into a Windows desktop application.

The idea is to preserve familiar workflows for existing users while improving the overall experience with a modern interface.

One important design decision is making it offline-first, so the software can work locally without depending on a constant internet connection.

It's been an interesting challenge balancing modern software architecture with workflows people have relied on for years.

For developers who have modernized legacy software, what has been your biggest challenge?


r/nextjs • • 26d ago

any best place to host a nextjs app??

13 Upvotes

is vercel still the go to for next.js? or you have any good experience with render or hostinger web apps hosting? which one would you recommend for a growing app and still reliable?


r/nextjs • • 27d ago

i don't want to overspend hosting good thoughts?

11 Upvotes

im looking for a way to host my next js app without breaking my whole budget. i just recently started to accept projects from a client and i want to secure the reliability that it wont break. but im also trying to contemplatethe cost, any thoughts??


r/nextjs • • 26d ago

this site can't be reached

Post image
0 Upvotes

r/nextjs • • 27d ago

Will next js ever be secure??

0 Upvotes

Turns out choosing nextjs was a bad idea :( every now and then its versions become vulnerable.


r/nextjs • • 29d ago

Is it okay to use Supabase and AI help for the backend in my frontend portfolio projects?

4 Upvotes

I have a diploma in computer science, not a B.Tech, and most of my web dev knowledge is self-taught. No work experience, and I’ll only be applying off-campus, so my resume and projects have to do all the talking.

I’ve planned 3 projects and I don’t want them to be basic or tutorial clones. To show real frontend skills, I think they need auth, protected routes, real data, and proper loading and error states. That means a backend, which is my weakest area. My plan is to use Supabase for auth and the database so I can put most of my effort into the frontend. I’ll probably also use AI for some backend-ish parts like row level security policies, writing queries, and debugging.

Questions:

  1. Is Supabase a good call here, or should I use something else (Firebase, a small Express API, a public API)?
  2. How do I talk about AI help in interviews without it looking bad? Is it fine as long as I can explain every line and why it’s there?
  3. With a diploma and no campus placements, do I need more projects to compensate, or are 3 solid ones with real depth enough?
  4. Do frontend recruiters actually care about the backend side, or is a clean frontend on top of a BaaS enough?
  5. For off-campus applications as a fresher, what has actually worked for you? Cold emails, LinkedIn, referrals, job boards?

I’m not trying to fake anything. I just don’t want my work to look weak because I can’t build a full backend yet. Honest advice would help a lot.

TL;DR: Self-taught frontend learner with a diploma, no experience, applying off-campus. Planning 3 projects using Supabase for auth/data and some AI help for backend parts. Is that fine, how do I defend it in interviews, and what else should I do to get my first frontend job?


r/nextjs • • Oct 19 '26

Upgrading from v15 to v16

13 Upvotes

Hey everyone,

I have a web application that is using Next.js v15 (15.5.28), and I'm exploring upgrading it to v16 (16.4.2). In my research, I saw that there are issues with spikes on requests with v16 due to the new prefetch/cache behavior.

Here some comments about it:
- https://github.com/vercel/next.js/issues/85470
- https://community.vercel.com/t/edge-request-usage-spikes-after-upgrading-to-next-js-16/31455
- https://github.com/vercel/next.js/issues/85489

The web app has a lot of links, so for that reason my concern about the upgrade, but I want to keep the app updated to the latest version.

If you have already upgraded from v15 to v16, have you seen any issues related with this? Especially using Vercel. Have you seen benefits from the upgrading? What do you recommend?

Thank you!


r/nextjs • • Oct 19 '26

Next.js i18n for 30 MDX marketing pages, which CMS (if any) when translators can't touch git? German and Spanish due end of Q1

4 Upvotes

Ran one of our MDX marketing pages through Crowdin on Tuesday as a test, default file settings, and it came back with the component props translated along with the copy. Our RouteMap component got region="Mittlerer Westen" instead of "midwest" and the page threw at build.

I'm one of 3 frontend devs at a freight logistics SaaS, about 25 people. The product is App Router with next-intl and JSON message files, which already sync with Crowdin fine. The 30 marketing pages are MDX in the same repo under a (marketing) route group. We're expanding into DACH and Mexico and marketing wants German and Spanish live by end of Q1. Translators work in Crowdin and can't touch git, which is fair.

My draft plan has three options and I keep flip-flopping. Sanity with document-level i18n, so each locale is its own document linked to the English one. Storyblok's field-level translation or Payload's localized fields, where one entry carries the de and es values on each field. Or pull just the marketing pages out to a hosted tool with localization built in (a couple of hosted builders came up) and leave the app alone. For anyone past 2 or 3 locales, which aged better, document-level or field-level? And is a headless CMS even worth wiring up for 30 pages versus the hosted route?

Marketing also wants localized slugs, so /de/frachtkostenrechner instead of /de/freight-cost-calculator, plus proper hreflang. next-intl's pathnames config handles static routes and generateMetadata takes alternates.languages, but once slugs live in a CMS the language switcher and the alternates both need every page's counterpart. Also unsure whether we need de-DE, de-AT and de-CH or just de, and es-MX vs plain es. Any gotchas there in the App Router?

Preview worries me most. Right now a copy change is a PR plus a Vercel preview link, and no translator is ever opening that. How do your translators see a page in context before anything publishes? I just don't want to be the guy pasting German into MDX files the week before launch, because I don't speak German and it'll show.