Stop 01 · Web & JavaScript FoundationsTopics · 1/10

What Is the MERN Stack

Part of the MERN Stack Roadmap

In short

MERN lets you build a complete web app, from the button a user taps to the data saved on a server, using only JavaScript. Learn one language well and you can work on every layer.

MERN is four JavaScript tools used together: MongoDB stores data, Express and Node.js run the API on the server, and React builds the interface in the browser. One language runs the whole app.

The jaadu runs a small roadside dhaba, carrying an order slip from a customer's table to the kitchen counter while a store room full of labelled jars waits behind.

Think of it like this

A dhaba with four stations

In a busy dhaba, the waiter takes your order at the table (React), passes the slip to the counter (Express), the kitchen does the cooking (Node.js runs it all) and ingredients come from the store room (MongoDB). Each station has one job, and they all speak the same language, so orders move fast.

Watch it happen

One click travels through the stack

React (browser)
Express on Node
MongoDB

GET /api/products

1/5Priya opens the shop page. React calls the API with fetch.

The big ideas

What you need to know

M is MongoDB

A document database that stores data as JSON-like documents, so it fits naturally with JavaScript objects.

E is Express

A small framework on top of Node.js for defining API routes like GET /api/products and adding middleware.

R is React

A library for building the user interface out of reusable components that re-render when data changes.

N is Node.js

The runtime that lets JavaScript run on a server, outside the browser. Express and your API code run on it.

How it works

How the pieces connect

  1. 1

    User acts

    Someone clicks, types or opens a page in the React app.

  2. 2

    React calls the API

    fetch sends an HTTP request with JSON to your Express server.

  3. 3

    Express handles it

    A route checks the request and asks the database for data.

  4. 4

    MongoDB answers

    Documents come back and Express sends them as JSON.

  5. 5

    React updates

    State changes and the screen re-renders with fresh data.

See it in code

Walk through the code

js
1// server.js (Express on Node.js)2import express from "express";3import { Product } from "./models/product.js";4 5const app = express();6 7app.get("/api/products", async (req, res) => {8  const products = await Product.find({ inStock: true });9  res.json(products);10});11 12app.listen(5000, () => console.log("API on port 5000"));13 14// In React: fetch("/api/products").then((r) => r.json())

1/4Import Express and a Mongoose model that talks to MongoDB.

A taste of the whole stack in one file. You will build each part properly in later phases.

Save yourself the pain

Common mistakes

Oops

Thinking React talks to MongoDB directly.

Do this instead

The browser never touches the database. React calls your Express API, and only the server holds the database password.

Oops

Trying to learn all four pieces at the same time.

Do this instead

Get comfortable with JavaScript first, then Node and Express, then MongoDB, then React. Each layer builds on the one before.

Your mission

Map an app you use

~15 min

Quick check

In a MERN app, which piece decides what happens when a request arrives at /api/orders?

Go deeper

  1. 1Draw a box for each of the four pieces and an arrow showing how a click in React reaches MongoDB.
  2. 2Pick an app you use, such as a food delivery app, and guess which part each MERN piece would handle.
  3. 3Skim this roadmap's 15 phases so you know where each piece is taught.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge