Warning: Rant ahead.
When NextJs first became popular, it was a remarkably easy way to build full stack application and soon became the my default choice. But after using it for years, I have decided to move away from it.
Problems
It has become too complex
Over time NextJs has introduced tons of complexity, with latest one being Server Actions. Learning curve is much higher now and going through NextJs documentation has become a herculean task. USP of simplicity is gone.
Too many breaking changes
Page router to app router has created so many problems. Like API level configs don't work anymore and now we need to learn about Server Actions to achieve this.
Customisation
Any use case which differs from what NextJs creators intended to do is simply painful. NextJs has decided that API requests can have 1Mb request body, I have an API which uses request body of > 1 Mb (passing a base64 image), achieving that has no good alternative.
Page router has some config options but app router doesn't or they are not documented. The only way to achieve it is either create a custom server (What's the point of NextJs then) or learn about Server Actions, which may or may not provide a solution.
At this point, you start wondering what was the problem with the simple express server.
My Conclusion
Any highly opinionated framework should be simple to work with, nobody wants something which is restrictive and needs a high learning curve. The only use cases someone should consider using NextJs is
- Extreme need for Server Side Rendering
- Hobby project with known and simple scope
Top comments (12)
Forget server actions, I could hardly get pass the eslint and webpack errors in both development and ghpage deployment.
It's valid to express concerns and challenges faced with any framework or tool, including Next.js. However, it's important to note that opinions about a framework can vary based on individual experiences and project requirements.
For many developers, especially those working on projects with common requirements, Next.js continues to offer a straightforward and efficient way to build React applications. The simplicity of creating server-rendered pages, automatic code splitting, and easy deployment with features like next export can significantly benefit projects with standard needs.
While it's true that Next.js introduces new features over time, many of these are optional and can be incrementally adopted based on project requirements. Features like Server Actions might not be necessary for every project, and developers can choose to use them as needed, maintaining simplicity for smaller projects.
Despite the perceived limitations, Next.js provides a fair degree of flexibility in configuration. Developers can customize webpack configurations, use middleware, and even extend or override default behaviors. This allows for tailoring the framework to specific project needs.
Ultimately, the choice of a framework depends on the specific needs of a project, the preferences of the development team, and the long-term goals of the application. It's essential to consider both the positive aspects and challenges of any technology before making a decision.
Next js it' cool, but I agree with you, it is becoming dark, perhaps difficult to use, I don't know if it is a question of adapting to the changes.
I'm liking Astro to be the next battlehorse
But why on earth will you be passing a base64 string in a payload? you can use cdn or image storage resources all over the globe like firebase storage or azure blob o AWS let alone alibaba then you get a url to the image and implement whatever logic you want.
True 100% , you can use cloudinary with its widget api for drag&drop image input , or use the api then save the link in db , or maybe this will be in front ,and send post request with link in it to external express/nest backend or any external backend
I get what you mean about it being complex. While I won't say I hate it, there are simpler options that can do the job just as well. Personally, I prefer using Fastify for APIs. As for the front end, it really depends on how complex the project is and how long it's going to last.
Interesting. I was and still am super happy with nextjs, especially in connection with vercel. What is your alternative now?
Going back to basics: Express + React for WebApps.
For landing pages where SEO ( and thus SSR is high priority) I'll give Astro a try
OMG. Just heard from Astro the first time. It sounds amazing! Thanks for sharing :)
Astro is fantastic and the community is great. Highly recommended!
I will 100% check it out. I liked Gatsby back then a lot, because of their focus on the static part, and they seem like Gatsby ++
Good luck with that 🚀