Why we ditched Next.js and never looked back
22 points by Jackevansevo
22 points by Jackevansevo
Hm. The article starts off interesting, but imo far too light on details as a n=1 case-study (what features does next.js have that are responsible for the bottleneck and are they useful?).
Basic page renders were taking 200-400ms.
Wait wait wait. They were taking that time doing what exactly? Is that purely the JS executor time? Or does it include lots of unrelated queries / file reads? Is that behaviour for cold cache? Basically, this number doesn’t mean anything without more context.
Other than paint times in my opinion it’s their shift to their own internal point of view: they are constantly pushing to improve performance against their own infrastructure, not for the use case of using it in the wild. If you see Next.js in a way, it’s like the Apple’s model: it works perfectly, but mostly on their infrastructure (Vercel).
To me is a framework that eats a lot from a lot of places that not necessarily has good (despite being good at routing, caching, etc) appetite for. It’s to opinionated and that’s cause a dead by a thousand cuts, and I’m not even speaking about tech: people learning tools instead of domain, migrations are a mess, little to no control on the tool itself although the tool controls a lot of your workbench, their technical problems are yours, too specific for the infra, etc
- It was a black box
Yes, this is the most critical thing I relate to and it does not affect directly technically your team. Recently, I joined a company and now at $WORK$ we use Next.js, oh boy, what a dumpster fire. Other than the performance to the external world and facing customers, It’s literally the worst solution to rule them all since not only you don’t control anything it matters for when at scale, but also it has so much hidden knowledge spread around that someone new being on-boarded on this framework will ask thousands of times why before doing meaningful contributions
It’s a good tool, don’t get me wrong, but so far in my experience, whenever I see Next.js in the wild, it is always like this blog post: a decision that someone wants to override because at scale, it breaks. However, it’s a tool that makes your team to enforce an style, to be more organized, etc
We didn’t move to Astro or another framework. We built our own server-side rendering system using plain React and Express.
This is what I don’t understand about the JS community. I’d slap Rails on it and that’s it. Ready for another 20y.
Does rails have SSR now?
Rails used SSR since the first release. If you mean “SSR my React dot JS components”, we released a solution for this at Airbnb in 2014.
This sounds more like poorly implemented Next.js. It’s not that slow, many sites have proven that.
Big difference if you self host nextjs in a naive way vs let Vercel host nextjs so you get all the global cache invalidation, ISR, etc. given they complain about stuff being flaky with >1 replica I take it that they’re self hosting. Self hosting does feel like a barely supported hack that’s only one step up from dev mode. We shifted to Vercel hosting and pay for it, but it’s nice to get all the cache stuff, “edge” etc.
I wonder how it’d be best to handle things like routing and application rehydration if you go with their proposed approach, personally I love RTK Query, and would love to be able to keep the application as is, with minimal changes, which next.js forces me to do