Why Bother With NextJS
Why even use NextJS? what does it even have going for it?
I’ve Used Next.js for 3 Years, and I’m Starting to Question It
I’ve been using Next.js for the past 3 years on many projects. Personal projects, web apps, dashboards, static websites, and much more.
I have experience with its caching, rendering modes, routers, SEO, serverless functions, proxies… etc.
The amount of features Next.js provides is certainly a lot, all built in too. But most of the time, all you need is plain and simple SSR with a few other features that shouldn’t require understanding an entire ecosystem to get into.
Plus, the abhorrently slow dev and production builds, and the weirdly high resource usage on deployments. Heavy CPU utilization, high memory usage, and a lot of disk reads sometimes.
Two Projects, Two Different Problems
Examples of my experience are two distinct websites that, for some reason, suffer from the same issues for different reasons.
The first one is a platform for selling digital products like game keys, accounts, gift cards… etc. That platform started as a Next.js project. Performance was quite good at first, with good production speeds, but slowly, as the dashboards were built and OAuth flows were implemented, things started getting worse.
And this happened without me making any actual infrastructure changes to the app itself, or introducing anything particularly resource-intensive like additional state management or server actions.
Production memory usage going up to 2 GB? CPU usage sitting at 10–30%?
Next.js was supposed to be a quick, smooth frontend framework that would supposedly let my servers handle much more, much faster, while giving users a fast experience.
When Image Optimization Becomes a Bottleneck
The second site had a lot of images, so Next.js image optimization was bottlenecking many requests.
For a site like that, the best choice would be to save the cropped and transformed images somewhere instead of generating them on every request. That’s true.
But the weird thing wasn’t CPU usage for this site. It was disk I/O. Random spikes reaching gigabytes per second, with constant smaller spikes every few seconds.
Migrating to React Router 7 and using a small JS library for image transformations practically obliterated both issues.
My server obviously didn’t like Next.js. Neither did my computer during development, and the production website performance wasn’t great either. Dropped requests, slow loading, and all.
Giving React Router 7 a Try
After many optimization attempts to lower resource usage and make things faster, including caching and SSG on different routes, I decided to give another framework a try.
For this, I decided to try out React Router 7.
Why?
Well, it supports SSR, allows me to work with client-side and server-side rendering in a more flexible way, and honestly, its loaders and actions make data fetching and mutations feel pretty straightforward. I can also implement my own caching and SEO strategies without having to rely on an entire framework-specific ecosystem.
And so… after migrating the same app to React Router 7, which took a few days thanks to AI being a helpful little feller doing most of the repetitive work, the platform was now running on a new framework.
The Results: Less Resource Usage, Fewer Dropped Requests
The CPU usage for React Router running inside a Docker container was around 1%, and memory usage stayed at around 80 MB, with spikes to 200 MB.
After deploying to a staging server and routing a few requests to the new site, I noticed a drop in dropped requests, which is a good sign.
But page load times were higher.
Confused, since the infrastructure, the app, and other factors that might contribute to this hadn’t significantly changed, I started looking at the code.
The Prefetching Discovery
That’s when I noticed that Next.js’s <Link /> comes with prefetching enabled by default under certain conditions in production. This could explain some of the difference in navigation performance and server workload.
So I tried enabling prefetching in React Router 7.
The result? The React Router app was now neck and neck with Next.js in production performance, and CPU usage barely moved.
Now, this doesn’t necessarily prove that Next.js itself was responsible for all the resource usage issues I was experiencing. There are many variables at play, and a proper benchmark would be needed to draw that conclusion.
But it does make me wonder how much of that overhead comes from the framework itself, its defaults, and the additional work it performs behind the scenes.
What Do You Actually Lose by Leaving Next.js?
A few things to consider:
You do lose access to many things that Next.js gives you out of the box, which most other frameworks don’t offer in quite the same way.
Mainly Open Graph image generation, caching, loading screens (client-side loading screens don’t feel as good), and font optimizations. Though the latter can be replaced with a good font configuration.
That’s basically it, at least for my use cases.
For OG images, you can use packages like @jsquash/webp and @resvg/resvg-wasm as part of an alternative image generation pipeline. Depending on your needs, this can be a better fit than relying on framework-specific tooling.
Caching depends on the framework and your implementation. React Router 7 gives you control over server-side caching strategies, and with the right setup, you’re not necessarily losing much by migrating away from Next.js.
The Vite Ecosystem and a Better Development Experience
And with all that, you get access to Vite’s plugin ecosystem, easier integrations with other libraries and frameworks that use Vite, a faster development experience, lower resource usage in my case, and overall, a development workflow I prefer.
Maybe It’s Not Always the Developer’s Fault
The point is, suffering with Next.js for the past few years has often felt like I was doing something wrong. And I feel like many developers feel the same way.
Sometimes, it’s not just a feeling, either. Next.js can have real infrastructure costs for developers, especially when its resource usage translates into more expensive deployments or limits how much traffic a server can handle.
I’ve seen complaints about performance, resource usage, and other issues with Next.js, including some that have nothing to do with technical performance. But I almost always see the blame get put on the developer instead of the framework itself.
It’s as if some developers who use it swear by it and deflect any criticism towards it.
And that’s what bothers me the most. Frameworks should be scrutinized just like any other piece of software. Their abstractions, defaults, and internal implementations aren’t above criticism just because they’re popular.
Sometimes the problem really is the developer. Sometimes it’s the infrastructure. And sometimes, the framework itself deserves a closer look.
I don’t know where I was going with this. This has been a ramble off my shoulders.
Thank you for reading.