Course home
FSWD · MERN STACK UNIT 4 / 5
4UNIT

FSWD · MERN Stack · Three letters land

Your code leaves the browser. Node.

Everything you've built so far ran inside someone's browser — and every order the form ever collected had nowhere to be saved. This unit builds the other half of full-stack: Node servers, Express APIs, a real MongoDB database, and a Redis cache in front of it.

M · MongoDB E · Express R · React N · Node R IS ALREADY YOURS FROM UNIT 3. N, E AND M ALL LAND HERE — BY LAB 10 THE WHOLE STACK IS YOURS.
Node & Expressservers and real APIs
MongoDBdata that survives a restart
Redis Cachingthe same answer, faster
12Classroom sessions · 60 min each
3Labs · 120 min each
11Exam-style questions solved along the way

Your 15 sessions, in order

Four classes teach it.
Then one lab builds it into your server.

The unit's biggest structural moment comes first: folder fork #2. A server isn't a browser page — it can't live inside poshtik-campus/ or poshtik-campus-react/ — so Class 29 creates poshtik-campus-server/ fresh, after explaining exactly why. Three rounds this unit, not two: raw Node, then Express, then the database and cache.

Round 1

JavaScript without a browser

29CLASS Node.js Setup, Life Cycle & the REPL

Why a server-side language at all — a real order needs somewhere to be saved. Folder fork #2 explained plainly, Node re-verified from Class 21's install, the REPL as your first browserless JavaScript, and running a .js file with node.

Folder fork #2 — explained first Terminal becomes home
SOON
30CLASS Node Modules — the FS Module

What a module is, fs.readFile vs fs.readFileSync side by side, the classic async print-order surprise — and your bilingual menu saved as menu.json, the first real file the server project owns.

menu.json is born Exam question solved
SOON
31CLASS Node Modules — HTTP, URL & Redirects

http.createServer and your first server answering a real browser at localhost:3000, the url module parsing paths, hand-rolled routing with if/switch (the "poor man's router"), and a real 302 redirect watched in the Network tab.

First server, from scratch
SOON
32CLASS NPM

The package registry behind that npm create vite moment from Class 21 — npm init and your server's own package.json, installing packages, node_modules, dependencies vs devDependencies, and the npm start convention.

package.json created for real Exam question solved
SOON
LABEIGHT A Real Node Server for Poshtik Campus

Same poshtik-campus-server/ from Class 32 — today it becomes a running server: menu.json read with fs and served at /menu, plus / and /contact routes, all raw Node. Closes with the honest itch: hand-rolling every path doesn't scale.

Your server, live Exam question solved
SOON
Round 2

Async for real, then Express

33CLASS Callbacks, Events & Blocking vs Non-Blocking

Callbacks formalised, a synchronous file read genuinely freezing a server for everyone — felt, then fixed. The events module with a custom orderPlaced event, and why Node's one-thread, non-blocking style suits this work.

The async surprise, resolved Exam question solved
SOON
34CLASS Introduction to Express

The exact tedium of Class 31's hand-rolled router, removed. npm install express, a first app in three lines shown side by side with the raw version, routing basics — and the Poshtik Campus menu returned as real JSON for the first time.

Build-It-Twice: raw vs Express
SOON
35CLASS Express — Handling Requests & Responses

Native modules named and tied back to Classes 29–31, reading a request body with express.json() (and the body-parser story the exam still asks), your order form's data reaching a server for the first time, and honest status codes.

The form finally lands somewhere 2 exam questions solved
SOON
36CLASS Express — Query Params & Middleware

?category=millet filtering the menu with req.query — your Unit-2 .filter() working server-side now — plus what middleware really is, a logging middleware you write yourself, and a stub previewing Unit 5's JWT auth shape.

Filters & middleware 2 exam questions solved
SOON
LABNINE The Full Poshtik Campus Express API

Same server folder, now a complete API: GET /menu with the full bilingual list, GET /menu?category=... filtered, and POST /order validating the order form server-side — the API your Unit-3 React app will eventually call. One catch remains: orders still vanish on restart.

A real API ships Cliffhanger: data that vanishes
SOON
Round 3

A real database, then a cache in front of it

37CLASS SQL vs NoSQL & Introducing MongoDB

Lab 9's vanishing orders get their diagnosis: in-memory data. What a database is, SQL vs NoSQL compared honestly, six real scenarios sorted between them — then MongoDB and Compass installed and toured.

The M arrives
SOON
38CLASS MongoDB CRUD — Create & Read

The dishes collection created, one document inserted, then the full 10-item bilingual menu seeded with insertMany — so find(), findOne() and the $gt/$lt/$regex operators run against real data with real, meaningfully-partial answers.

Your menu becomes documents
SOON
39CLASS CRUD Completed & MongoDB Meets Node

updateOne with $set, deleteOne, a full insert-update-delete sequence from a written spec — then the official driver connects Node to MongoDB and Lab 9's /menu route reads from the real dishes collection instead of a hardcoded array.

The API goes database-backed 2 exam questions solved
SOON
40CLASS MongoDB Services & Key-Value Caching

Atlas, indexing and aggregation surveyed — then the unit's final idea: what if the same query runs a thousand times a minute? Redis installed, SET / GET / EXPIRE, and the /menu route checking the cache first, falling back to MongoDB on a miss.

Redis joins the stack
SOON
LABTEN The Complete Data Layer — Mongo + Redis

Opens with the MERN payoff — all four letters, all built by you. Then the finale: the menu seeded into MongoDB, POST /order saving into a real orders collection, Redis caching on the busiest route, and the Unit-4 recap with exam strategy.

MERN — all four letters yours Exam question solved
SOON

The running project · folder fork #2

Same campus. Now it has a kitchen out back.

Poshtik Campus పౌష్టిక్ క్యాంపస్ · poshtik-campus-server/ begins

"A server is not a browser page — it needs its own project, separate from both earlier folders." That's Class 29's opening explanation, given before a single line of server code. Your static original and your React app both stay exactly as you finished them — this unit builds the machine they'll talk to.

The data is still the continuity: the same bilingual menu from Class 17's poshtikMenu array becomes menu.json in Class 30, then MongoDB's dishes collection in Class 38 — the exact 10 items, never a toy dataset. By Lab 10, the order form you built in Unit 1 has a real API validating it and a real database remembering it.

What ships in your project this unit
  • poshtik-campus-server/ — a real Node project with its own package.json (Class 32), growing through all three labs
  • An Express API — GET /menu, GET /menu?category=... and a validating POST /order (Lab 9)
  • MongoDB dishes and orders collections — data that finally survives a restart (Lab 10)
  • Redis caching on the busiest route — cache-hit vs cache-miss timed for real (Lab 10)
  • Commit-and-push discipline continues — the server repo gets the same habit from its first commit
poshtik-campus-server · the API by Lab 10

This terminal is live — boot the server, then fire the requests yourself. Watch /menu go from cache MISS to cache HIT, and watch the bad order get rejected. Terminal truth is this unit's habit.