11 August, 2025
mernnextjsIs MERN Stack Still Relevent?
Introduction
MERN stack is a popular technology stack to make web site and web application.
Is MERN stack still relevent in 2025 when Nextjs exists?
Should we fire up a new project using MERN stack?
Let's talk about it.
About MERN stack
MERN stack consists of MongoDB, Express, React, and Node.js.
It uses two different codebases to build a 3-tier web application.
The two codebases are: React powered frontend client code and Express-Node.js powered backend server code.
The Nodejs server handles api endpoints and the React client fetch data from those endpoints with fetch API.
What Problem does MERN stack solve
Even thought MERN stack does not solve any specific problem of the web development, it is powerful tool to build web application and web site.
If you can imagine it you can build with MERN stack.
MERN stack is single language stack and the language is JavaScript (or Typescript). It is also a SPA (Single Page Application) out of the box.
The stack itself is very modular. So, it is very easy to swap out any component or library if needed.
But it is not all rainbows and sunshine. There are some problems with this stack.
Problem with MERN stack
The developer experience of MERN stack is not great. Even if typescript is used in the project, it is still unintuitive.
The loading time of the site or app is slow because the whole react code has to load before rendering anything.
There is no SSR (Server Side Rendering) so the site is not SEO friendly. Even if the SEO is implemented through the html, it is not dynamic.
There is no optimization for the images, fonts, etc. The site is not optimized for performance. The Developer has to do a lot of work to make the site fast, optimized and SEO friendly.
It does not support routing out of the box.
Nextjs enters the chat room
Nextjs is a meta framework for react created by Vercel. It is one of the most powerful framework out there. It is very fast, optimized, and SEO friendly.
Nextjs is also support SPA. It has SSR and SSG (Static Site Generation). It also has routing. From Nextjs 13, it supports file-system-based
routing.
It is very fast because it does not load the whole react code to render page. It only loads the code needed for the page. It comes with image optimization and font optimization.
The developer experience is great. It is intuitive to use.
Developer can create api endpoints with Nextjs. Because of server action, developers does not even have to create api.
Nextjs solve many problems with MERN stack and more.
Nextjs is a bit hard
Developers that are used to write MERN stack code might have porblem to adopt Nextjs.
Nextjs being a framework requires certain structure in the codebase. But unlike MERN stack, it actually uses a single codebase for serving both client-side and server-side code.
This is the biggest W or L for Nextjs depends on how one frames it. To run code into differect environment (client and server), directives like "use client"
and "use server"
is used. This can be a bit confusing and unintuitive.
Conclusion
MERN stack is good, but it has its moments.
Nextjs is a necessary evolution of MERN stack. Even the official doc of React recommends to use Nextjs.
Nextjs is the new home for React.