Criticism of nextjs

Criticism of nextjs

NextJs is a framework meant to build frontends but can also be used as full stack framework and is rapidly gaining popularity. Howoever, there are some pitfalls you should be aware of when it comes to chosing nextjs over other frameworks.

Table of content

  1. NextJS is resource intensive
  2. NextJS adds needless complexity
  3. Nextjs scales poorly with large teams
  4. Application security
  5. Nextjs is good for SEO only
  6. Suspicion around Vercel
  7. Conclusion

NextJS is resource intensive

NextJS uses nodejs based server environment to render pages. In that sense is more like a backend of frontend server. Adding NextJs to your webapp would mean you will use significantly more server resources than purely server driven webapp such as python Django.

This in some sense is extra devops complexity, more engineering complexity but might be worth it if you want your frontend to be more decoupled and have some very specific optimizations in mind. Such as NextJS can optimize images automatically for you.

NextJS adds needless complexity

Nextjs might be solving a problem that does not exist. Most often developers are looking to use react. It is harder to setup react with other frameworks and hence people look for existing frameworks and end up setting nextjs as framework of choice. React is a library and not an Angular like full fledged framework.

It is extremely simple to start with nextjs. However running a full server just you can render some pages isn't really optimal especially when it does a lot of complex work. It checks whether a page needs to be server rendered or generated on client, forces a lot of conventions on you and if you don't use them you end up writing suboptimal code.

Nextjs scales poorly with large teams

Nextjs app is basically one large app with everything under the app or pages directory. When you run it, it starts an entire application. You can not ask it to ignore certain parts entirely. If there is a lint error in someone else's code you might get blocked.

Everything with Nextjs gets complicated pretty soon. As you start using libraries you will often see that same object type is being repeated at n places and eventually the code becomes harder to follow.

Application security

Nextjs also supports full stack development but you have to be extremely mindful to not leak your private info in the client code. For example your cloud service api keys, environment variables can leak into frontend code if you are not careful.

Nextjs is good for SEO only

There is no real benefit in using nextjs compared to many other services such as angular except the SEO. NextJS makes it easy for you to get perfect web performance and SEO scores by doing lot of optimizations out of the box. This makes your website much more visible and higher ranked by search engines but this feature is useless if you are building say an enterprise app.

Suspicion around Vercel

Vercel is the company backing nextjs. This blog too is hosted on Vercel. However we you look closely there is not much of innovation going on in what vercel has to offer. It just makes it easy to deploy your nextjs app and provide wrappers around existing cloud services but with significantly higher cost. It is infact cheaper to use Google Cloud to host a nextjs app than Vercel. This blog is on the free plan so it does not matter to us. But we have written a popular tutorial on how to run a nextjs webapp on Google cloud run.

Vercel blob service is like Google Cloud Storage or Amazon's S3 but is incredibly expensive.

Conclusion

NextJs is popular but not without problems. There are many good reasons why you should not pick nextjs as your framework of choice and rather stick to a more conventional framework like Django or Ruby on Rails.