←back to thread

Next.js is infuriating

(blog.meca.sh)
1033 points Bogdanp | 1 comments | | HN request time: 0.199s | source
Show context
kremi ◴[] No.45102052[source]
I think “middleware” is a bit of a misnomer in Next.js. It’s really an edge function that runs before your request hits the app -- quick header checks, routing, and other lightweight guards. It runs on the edge runtime, not on the app server.

The post's author seems to conflate the edge runtime with the server runtime. They’re separate environments with different constraints and trade-offs.

I struggled with Next.js at first for the same reason: you have to know what runs where (edge, server, client). Because it’s all JavaScript, the boundaries can blur. So having a clear mental model matters. But blaming Next.js for that complexity is like blaming a toolbox for having more than a hammer.

replies(5): >>45102174 #>>45102311 #>>45102380 #>>45102454 #>>45102698 #
1. koonsolo ◴[] No.45102454[source]
I'm also working with Next.js, app router, and like it very much.

The problem is probably that Next.js makes it very easy to move between front and back end, but people think this part is abstracted away.

It's actually a pretty complex system, and you need to be able to handle that complexity yourself. But complexity does not mean it makes you slower or less productive.

A system with a clearly separated front- and back-end is easier to reason about, but it's also more cumbersome to get things done.

So to anyone who knows React and wants to move to Next.js, I would warn that even though you know React, Next.js has a pretty step learning curve, and some things you will have to experience yourself and figure out. But once you do, it's a convenient system to easily move between front- and back-end without too much hassle.