The MERN stack is one of the most famous stacks in the JavaScript ecosystem. A combination of MongoDB, Express.js, React and Node to build web applications. Unfortunately, MERN isn't ready for modern application in the Serverless world.
Today, you can deploy your React application to modern static hosting services like Netlify or Cloudflare pages. These platforms remove the burden to manage servers for your application frontend.
Same for the backend side, the Serverless community has grown a lot. There is now a lot of tutorial on how to write an Express.js backend on AWS Lambda. If you have already written the Express.js code, you can easily convert to Serverless without any issue.
So what's wrong with the MERN stack for Serverless? The database.
A Serverless Database should work like the Serverless function. It needs to be:
Currently, the most used databases in the JS community are MongoDB, MySQL and PostgreSQL. But, none of them is Serverless for the production environment. There is some solution like AWS Aurora Serverless but there are several limitations and doesn't meet all the requirements.
The idea is to replace MongoDB with DynamoDB in your MERN stack. So, now it becomes DERN. DynamoDB is a true Serverless database: managed, highly scalable and scales to zero.
DynamoDB gives access to more interesting features that you can enable if you are interested:
One of the drawbacks I see with DynamoDB is the vendor lock-in to AWS. If you follow best practices, you shouldn't have any issue switching databases to a different cloud provider.
AWS is at the head of the Serverless race, AWS Lambda is more performant and provides more features when comparing to its competitor.
So, if you are building a Serverless application for production, you have a high chance to use already AWS ecosystem. Integrating DynamoDB into your stack shouldn't be a problem.
I recently launched my first SaaS product with a DERN stack, 100% serverless from backend to frontend. Definitively, it makes my developer life so much easier with no server management and I can now have a deep sleep ;)
PostMage is my first SaaS and it's built using the DERN stack. I've also written a detailed article about the tech stack as a solo developer.
It took me 5 months of development to build the first version of PostMage by spending a lot of time choosing the right tech stack, designing the landing page and the dashboard, implementing the authentication and the integration to Stripe.