Full-Stack Notes App
Part of the MERN Stack Roadmap
In short
This is your first real MERN app: the notes UI you built in React, now saving to MongoDB through your own Express API. Every later project, from e-commerce to job boards, is a bigger version of this.
Connect your Phase 8 notes app to an Express and MongoDB backend, with full CRUD, search, pagination and proper loading and error handling.

Think of it like this
From diary to library register
Your Phase 8 app was a pocket diary: notes vanished if you lost the browser. Now the notes go into the college library register, kept safely at the desk. You can ask the librarian to add, find, update or tear out a page, from any computer, and the register is always the truth.
Watch it happen
Building the app layer by layer
1/5Mongoose schema: title (required), body, tags, pinned, timestamps.
The big ideas
What you need to know
Full CRUD
Create, read, update and delete must all go through the API. Nothing important lives only in React state.
Search and paginate on the server
Use a regex or text index plus skip and limit in Mongoose. The client sends page and search as query params.
Every call has three states
Loading, error and success. Disable the Save button while a request is in flight.
Clean folders
server/ with models, routes, controllers, middleware. client/ with api, components, pages.
See it in code
Walk through the code
1// server/controllers/notes.js2import Note from "../models/Note.js";3 4function escapeRegex(text) {5 return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");6}7 8export async function listNotes(req, res, next) {9 try {10 const page = Math.max(1, Number(req.query.page) || 1);11 const limit = 10;12 const search = String(req.query.search || "").trim();13 const filter = search14 ? { title: { $regex: escapeRegex(search), $options: "i" } }15 : {};16 17 const [notes, total] = await Promise.all([18 Note.find(filter).sort({ pinned: -1, updatedAt: -1 }).skip((page - 1) * limit).limit(limit),19 Note.countDocuments(filter),20 ]);21 22 res.json({ notes, page, totalPages: Math.ceil(total / limit) });23 } catch (err) {24 next(err);25 }26}1/5Escape special characters so a search like "c++" doesn't break the regex.
The list endpoint: search, sort pinned first, paginate and return totals for the UI.
Save yourself the pain
Common mistakes
Oops
Loading every note and filtering in React.
Do this instead
Filter and paginate in MongoDB. The browser should only receive the page it shows.
Oops
Updating the UI before the server confirms, with no rollback on error.
Do this instead
Wait for the response, or if you update optimistically, undo the change when the request fails.
Oops
Committing the .env file with your MongoDB URI.
Do this instead
Add .env to .gitignore and include a .env.example with placeholder values.
Your mission
Ship the notes app
Quick check
Why does the list endpoint return totalPages along with the notes?
Go deeper
- 1Use a Vite proxy in development and VITE_API_URL in production.
- 2Use TanStack Query or RTK Query for fetching and mutations.
- 3Keep the client and server in one repo with clear client and server folders.
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.