The DERN stack, the perfect alternative to MERN stack for Serverless
Tags: javascript, react, serverless, aws
Published: 2021-09-30 21:20:57

---
title: The DERN stack, the perfect alternative to MERN stack for Serverless
description: DERN stack uses DynamoDB, Express.JS, React and Node.js in combination to build high-scalable SaaS products.
published: true
tags: javascript, react, serverless, aws
cover_image: https://gen.postmage.com/generate/2442b225-4afe-41be-a292-41e0a429ff5c/5880ddef-7cc1-4e3b-a5ac-66861e1c77f9/image.png?url=https://creativedesignsguru.com/dern-stack-alternative-mern/
canonical_url: https://creativedesignsguru.com/dern-stack-alternative-mern/
---

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.

![Mern stack logo](https://creativedesignsguru.com/assets/images/themes/mern-logo.png)

## A bottleneck in the database

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.

![Cloudflare pages hosting](https://creativedesignsguru.com/assets/images/themes/cloudflare-page-logo.png)

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.

<img src="https://creativedesignsguru.com/assets/images/themes/serverless-framework-logo.png" title="Serverless framework AWS lambda">
<img src="https://creativedesignsguru.com/assets/images/themes/express-js-logo.png" title="Express js serverless">

So what's wrong with the MERN stack for Serverless? **The database**.

## Requirements for a Serverless Database

A Serverless Database should work like the Serverless function. It needs to be:

- **Easy to use** and **Easy to configure**.
- **Pay-as-you-go pricing**, only charged for what you use.
- **Scalable**, can handle the request based on your usage.
- **Scale to Zero**, no cost when there is no request.
- **Managed service**, no maintenance in scaling and update.

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.

## DERN at the rescue

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.

![Dern stack logo](https://creativedesignsguru.com/assets/images/themes/dern-stack-logo.png)

DynamoDB gives access to more interesting features that you can enable if you are interested:

- **Continuous backups**, with Point-In-Time Recovery (PITR)
- **Global tables**, make your database close to your users
- **Streaming applications**, you can capture every changes in your table

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.

## DERN stack in action

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](https://postmage.com) 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](https://creativedesignsguru.com/saas-tech-stack/).

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.

So, I've built a [Next JS SaaS](https://nextlessjs.com) Boilerplate Template for you to start a SaaS product and save a ton of time.

[![Next JS SaaS Boilerplate Starter](https://creativedesignsguru.com/assets/images/themes/nextless-react-saas-boilerplate.png)](https://nextlessjs.com)