r/nextjs • • 12h ago

Are most devs sticking with Next.JS?

27 Upvotes

Hi everyone,

I’ve recently started learning TanStack Start, and it’s great, don’t get me wrong. However, there’s quite a bit of assembly involved. Next.js, on the other hand, seems pretty great to work with due to the many out-of-the-box features it provides.

How’s the mental model of working it with? According to the Stack overflow dev survey, this is one of top complaints.

How has your experience been with Next.js? What are some things you like or dislike about using it?

I’m retired so I mainly still code by hand mostly.


r/nextjs • • 1h ago

Next.js 16 moved caching to opt-in. What changed in your apps after upgrading?

2 Upvotes

Next.js 16 changes how caching works in the App Router. According to the docs, Cache Components are enabled with the cacheComponents flag, and caching is opt-in through the use cache directive. The existing fetch and unstable_cache caching still works as a separate layer while you migrate. The version 16 upgrade guide also says that dynamic, revalidate, and fetchCache route segment exports will error once Cache Components is enabled.

The part I find most worrying is the silent load change. Code that was fast because of implicit caching can start hitting the database on every request, and nothing in the code looks different. Tests can pass while query volume climbs.

For people who have already upgraded, I'd like to hear:

  1. Did you turn on Cache Components all at once or route by route, and what made you choose that approach?
  2. How did you catch query-count or latency regressions before production? Logging, load tests, or something else?
  3. Which cacheLife profiles and tags have worked well, and which ones did you change later?
  4. Did anything break in a way the upgrade guide didn't cover?

r/nextjs • • 23m ago

next-intl on Next.js 16: /apple-touch-icon.png and /ads.txt returned 500 until we gave not-found metadata an explicit locale

1 Upvotes

The server log gave us this:

Error: Page changed from static to dynamic at runtime /apple-touch-icon.png, reason: headers

The site is a client's B2B catalog on Next 16.2.9 and next-intl 4.13.0 (Cache Components off), every page under app/[locale]/. Paths that aren't real routes and aren't caught by the proxy matcher fall into [locale] with the path segment as the locale. /apple-touch-icon.png, /favicon.png, /ads.txt, /manifest.json, /sitemap_index.xml, /v1 and /trpc all returned 500, for every user agent we tried.

The locale layout already called notFound() for an unknown locale, so that wasn't it. The trouble came a step later. Next resolved [locale]/not-found.tsx's generateMetadata in a separate render, one where setRequestLocale had never run, and the implicit getTranslations("errors") made next-intl read request headers inside an ISR render. That's the 500 where a 404 should have been.

Two things we tried first did nothing. A pass-through root layout with a root not-found gave the same 500 and the same stack, and a locale guard on its own changed nothing either. What worked was making the metadata take params and translate with a locale we choose:

const { locale } = await params
const t = await getTranslations({
  locale: hasLocale(routing.locales, locale) ? locale : routing.defaultLocale,
  namespace: "errors",
})

We also added a hasLocale guard that calls notFound() at the top of the layout's generateMetadata, before any message fetch. On a local build /favicon.png, /ads.txt, /v1 and /trpc/contacts now return 404, and the log has no more "static to dynamic" errors. The apple touch icons return 200 because we copied the site's existing 180x180 icon into public/ for iOS probes that skip the link tag.

One catch: those junk paths now render once and get cached as ISR 404s, so a scanner could grow that cache. We'd filter them in nginx or the proxy.

A curl check on the same site also showed missing pages answering 200. With Cache Components off, a loading.tsx at the [locale] segment makes every route below it stream, and the Next docs say plainly that streamed responses start with a 200. The noindex tag was there, so indexing wasn't hurt, but the status was wrong. We removed the file, and on a local clean build the missing pages now return 404.

The price: the spinner now lives only on the two leaf segments that never call notFound(), so navigation into catalog, product, portfolio and CMS pages lost it.

Curl /ads.txt on your own app and see whether you get 404 or 500.


r/nextjs • • 7h ago

Wrote a guide for deploying a MERN app on a Hostinger VPS (Nginx, PM2, SSL) after fixing a bunch of real mistakes in my own setup

Thumbnail
medium.com
1 Upvotes

I spent a while fighting through a Hostinger VPS deployment for a MERN app: firewall rule ordering, Nginx config mix-ups, the classic "my frontend env changes aren't doing anything" issue. Wrote up everything I ran into along with the actual fixes, covering a brand new deploy, pushing new code to an app that's already live, Nginx as a reverse proxy, free SSL with Certbot, and Redis if you need it.

Sharing it in case it saves someone else the same debugging loop: https://medium.com/@kmahesh18001/how-to-deploy-a-mern-app-on-a-hostinger-vps-nginx-pm2-ssl-8180f7f2f019

Happy to answer questions if something's unclear, or if you hit a different issue on your own setup.