butadpj's logo butadpj

You Don't Understand NextJS (and most likely Vercel too)

Published: September 3, 2024
NextJS Vercel Frontend Modern tools Programming
Blog's background image

I know why you hatin’

A gif for haters

The hate for NextJS and/or Vercel usually comes from developers who don’t actually know what problems these tools solve. Well, I don’t really blame them as I have no idea why they decided to pick NextJS for their project. Maybe their team is already using it or want to use it. Or most likely, they just felt this immense pressure from the community that this new shining object ✨ is “the future”.

Still, I can’t figure out how does someone can spend energy hating on something. For me, if the tool doesn’t serve me well, I’ll just find a better one. Or if it’s for work, and I don’t have the control on what tools I’m going to be using, I’ll just suck it up. So, before we start hating on NextJS again, it’s better to ask ourselves a question

When do you really need to use NextJS?

Guess what? You don’t need to force NextJS onto a project where it’s not a good fit. You can tell that to your tech lead or senior : ). Now, how can you determine if you’ll benefit from using NextJS or it’s just going to make everything complicated?

🚫 You don’t need NextJS if…

🟠 You probably need NextJS if…

✅ You really need NextJS if…

NextJS and Vercel in detail

The good, the bad, and the ugly gif

Let’s dive a little deeper on how NextJS and Vercel actually works together. This will allow us to understand these tools really well and start making better decisions. But first, a little bit of history is needed to prepare you for the deep dive 🌊.

Previously, when developing complex web applications we’re only bound to choose between two (2) approaches. Either you do client-side rendering (SPA) or you do server-side rendering (SSR). Both have pros and cons, but, what we’ve learned after years of struggling to choose between these two approach are…

Now, it makes sense why NextJS easily became one of the most popular frameworks. It’s not just hype, it’s just NextJS makes it very easy for us to mix-and-match different approaches on serving our pages. So, let’s dive-in deep on how NextJS and Vercel provides the best DX for developing and managing web applications. Starting off with..

NextJS giving React an access to server

Vercel’s framework-defined infrastructure

Screenshot of NextJS build output

The ugly parts

You can almost see all the ugly parts of NextJS for every article that explains why they won’t use NextJS (see Why NextJS Sucks). So, I want to address the root of every problems you will encounter when you start using NextJS, and that’s only being…

Conclusion

It’s easy to hate on NextJS and Vercel if we don’t try to understand their purpose. The great DX that comes from these tools has definitely a price to be paid. Those who really want to ship features and not worry about their infrastructure, I supposed they are ready to pay the price. For those who can’t tolerate being vendor locked-in on to limited platforms, let me ask you a question. Are you currently working on production sites/apps that has lots of users? Because, any apps that require scaling, also needs someone or a team that’s very skilled at DevOps. So, either you stop worrying about scaling and just deploy your NextJS in a simple way (see NextJS self-hosting options), or be prepared to dive-in to DevOps to avoid being vendor locked-in.

Starting today, let this words from a wise programmer be part of our mantra - “There’s really no solutions for a problem, only tradeoffs”.

A master bowing