Development

MERN Stack Career Program

MongoDB, Express, React, and Node as one application you can explain.

★★★★★4.9 · Based on 104 learners120 lessons · 30 hr

MERN Stack Career Program builds one application across MongoDB, Express, React, and Node. You will see how a screen, an API, and a database share a feature. JavaScript and a first React course will make this much easier. The result is a project you can describe in an interview without inventing the parts.

Course syllabus

  1. 01. One notes app, four jobs

    • How the four pieces talk

      React, Node, Express, and MongoDB, each with a job.

      15 min
    • The app is a saved note

      A person writes a title and a note, then sees that note again after a refresh.

      17 min
    • Create and read come first

      Update and delete wait until create and read already survive a refresh.

      13 min
    • The browser is the client

      It shows screens and sends requests, and it does not own the notes.

      16 min
    • Node runs the process

      The process stays up and listens for those requests.

      18 min
    • Express is the route map

      A method and a path land on one function you wrote.

      14 min
    • MongoDB holds the notes

      Each note is a document with the fields you chose.

      18 min
    • Draw the path before code

      Screen, request, route, document, response, then the screen again.

      12 min
  2. 02. The feature on paper

    • The sentence this feature must match

      Add a title and a note, refresh, and see that title on the list.

      17 min
    • The fields you will store

      A title, a note, and the time the note was saved.

      15 min
    • What this pass leaves out

      No accounts, no sharing, and no extra fields you cannot explain.

      16 min
    • The happy path written down

      A valid title goes in, a document is saved, and the list shows the title.

      13 min
    • What an empty list should say

      A person with no notes sees a sentence, not a blank page.

      15 min
    • A blank title is a failure

      The server rejects it, and the screen says which field failed.

      17 min
    • A length limit you can point at

      You pick a maximum, and the server enforces that maximum.

      13 min
    • Who the feature is for

      One person using their own list on one machine, for this pass.

      16 min
  3. 03. Node starts the process

    • A folder for the API

      The server lives in its own directory, apart from the React app.

      18 min
    • A start script you can say

      One command runs the file you will edit.

      14 min
    • A process that listens

      It starts, binds a port, and waits.

      18 min
    • The port from the environment

      The number comes from a variable, with a default you can read in the file.

      12 min
    • A health route

      GET /health returns a short text so you know the process is up.

      17 min
    • Restart after you change the file

      Stop the process, start it again, and hit the health route.

      15 min
    • Read the server error in the terminal

      The stack trace stays there, and the browser only sees a failed request.

      16 min
    • Node is not drawing the list

      React will render the notes, and Node will answer the API.

      13 min
  4. 04. Routes for one feature

    • Express routes for one feature

      List, create, and read one note, as three routes with names you can say.

      15 min
    • A router mounted at /notes

      The handlers live in one file and attach under that path.

      17 min
    • GET /notes returns the list

      The handler loads documents and sends them as JSON.

      13 min
    • POST /notes inserts one note

      The handler reads the body and asks the database to insert.

      16 min
    • GET /notes/:id returns one note

      The id comes from the path, and a missing document is a 404.

      18 min
    • Method and path together

      POST /notes is a different request from GET /notes.

      14 min
    • One handler does one job

      The list handler does not also create a note.

      18 min
    • Call the routes before React

      Use curl so a screen bug is not confused with a route bug.

      12 min
  5. 05. Status codes and JSON

    • JSON in and JSON out

      The server parses a JSON body and sends JSON back.

      17 min
    • The four status codes you will use

      200, 201, 400, and 404, each tied to a case you can point at.

      15 min
    • 201 returns the saved note

      The body includes the document, including its id.

      16 min
    • 400 when the body is the wrong shape

      A missing title, or a title that is not text, fails here.

      13 min
    • 404 when the document is absent

      The route ran, and that id was not in the collection.

      15 min
    • Do not send the stack to the browser

      Log the error on the server, and send a short message.

      17 min
    • Say the response is JSON

      Set the content type so the client parses data, not an HTML error page.

      13 min
    • Send once, then return

      The handler writes one response and does not write a second.

      16 min
  6. 06. Validation the server owns

    • The server checks the title

      Blank, the wrong type, and over the length limit all fail in the route.

      18 min
    • Trim before you judge the title

      Spaces alone are not a title.

      14 min
    • The note may be empty

      A missing note becomes an empty string you chose to store.

      18 min
    • Ignore keys you did not define

      Extra fields in the body do not become new data.

      12 min
    • One function for the rules

      Create calls it, so the rule cannot drift into a second copy.

      17 min
    • The message names the field

      Say that the title failed, not only that the request was bad.

      15 min
    • The form is not the check

      A request can skip the form, and the route still rejects a bad body.

      16 min
    • Write the rules beside the function

      Required title, trimmed, and under the limit you picked.

      13 min
  7. 07. The note document

    • MongoDB documents

      A note is one document with a title, a note, a time, and an id.

      15 min
    • The database address stays on the server

      The connection string comes from the server environment.

      17 min
    • A collection named notes

      This feature uses one collection, and other shapes wait.

      13 min
    • _id is the identity

      You use the id MongoDB assigns, and you do not invent a second one.

      16 min
    • Store the time as a date

      createdAt is a date, not a display string built in the database.

      18 min
    • Save and return the same shape

      The fields you insert are the fields the list route sends.

      14 min
    • A document you can recite

      Title, note, time, and id, and nothing you cannot name.

      18 min
    • What the document does not hold

      No password, no role, and no price.

      12 min
  8. 08. Queries for the list

    • Find the notes

      The list route reads the collection and returns those documents.

      17 min
    • Sort by createdAt

      Newest first, so the order is a choice you can defend.

      15 min
    • Find one by id

      Turn the path parameter into an ObjectId, and handle a value that cannot convert.

      16 min
    • A bad id is 400

      The id was never valid, so this is not a missing note.

      13 min
    • Insert returns the saved document

      Send that document back so the client has the id.

      15 min
    • The list and the insert share a collection

      Both talk to notes, and neither writes somewhere else.

      17 min
    • A posted note is the note you read

      The title in the GET matches the title in the POST.

      13 min
    • Look in the shell after a POST

      The document is in the collection, not only in the HTTP response.

      16 min
  9. 09. React screens for the notes

    • React screens for that feature

      A form to add a note, and a list that renders what the server returned.

      18 min
    • Title and note in component state

      The form holds the fields until the person submits.

      14 min
    • The list starts empty

      State is an array, and it fills from the response.

      18 min
    • Fetch the list when the screen opens

      GET /notes runs on mount, then the JSON becomes state.

      12 min
    • Submit sends the current fields

      The handler posts JSON and waits for the response.

      17 min
    • Put the saved document on the list

      Use the body the server sent, or refetch, and do not invent an id.

      15 min
    • A page for one note

      The route param is the id, and the page asks the API for that document.

      16 min
    • Form, list, and detail stay separate

      Each component has one job you can name.

      13 min
  10. 10. The path of one save

    • From click to database

      Submit, validate, insert, and render the document that came back.

      15 min
    • The function that runs on submit

      It reads state, sends JSON, and branches on the status code.

      17 min
    • The route that receives the click

      POST /notes, the same route you already called with curl.

      13 min
    • The insert

      One document, limited to the fields the checker allowed.

      16 min
    • The response the list uses

      Id, title, note, and createdAt.

      18 min
    • The title on the page matches the document

      What you read on the screen is what was stored.

      13 min
    • Refresh still shows the note

      The list came from the database, not from memory in the tab.

      17 min
    • Say the hops in order

      You can narrate screen, route, check, insert, response, and screen again.

      11 min
  11. 11. What the browser must not decide

    • The browser does not decide what is stored

      The route chooses the fields, and the form only proposes them.

      16 min
    • A hidden button is not permission

      If the route allows the request, the screen cannot take that back.

      14 min
    • The database URI never reaches React

      The bundle and the page source do not contain the connection string.

      15 min
    • The form does not assign a role

      If a role exists later, the server sets it.

      12 min
    • The client does not choose _id

      The id in the list is the one the database returned.

      14 min
    • A form warning is only a courtesy

      It can speak early, and the route still rejects a bad body.

      16 min
    • The server message wins

      When the API returns 400, the screen shows that message.

      12 min
    • A request you can forge

      If curl can create a note, the UI was never the lock.

      15 min
  12. 12. Loading, empty, and failure

    • A line while the list loads

      The screen says the request is in flight.

      18 min
    • No documents is not an error

      The empty sentence is a real state.

      13 min
    • A network failure leaves the form filled

      The request did not return, and the typed note stays put.

      17 min
    • The 400 text sits by the title

      The person can see which field the server rejected.

      11 min
    • The detail page says the note is missing

      A 404 means that id is not a document.

      16 min
    • A 500 is a short sentence on screen

      The detail stays in the server log.

      14 min
    • Disable the button while the save runs

      One click sends one POST.

      15 min
    • Do not clear the form when save fails

      The person can fix the title without retyping the note.

      12 min
  13. 13. Edit and delete

    • PATCH is its own route

      PATCH /notes/:id changes a note, and it does not reuse POST.

      14 min
    • The edit screen loads the document

      The fields start from the saved title and note.

      16 min
    • PATCH uses the same title rules

      A blank title still fails with 400.

      12 min
    • The list shows the updated title

      After a successful PATCH, the old title is gone.

      15 min
    • DELETE removes one document

      The id must match, and the response says that note is gone.

      18 min
    • Ask before delete

      A confirm step so one stray click does not remove the note.

      13 min
    • Leave the detail page after delete

      That id would now 404.

      17 min
    • Editing a missing note shows 404

      The document was already gone, so the form does not pretend to save.

      11 min
  14. 14. Walk the files

    • Walking through the project

      Server entry, routes, validation, the database, then the React screens, in that order.

      16 min
    • Where the port is read

      The environment variable and the listen call.

      14 min
    • Where the title is checked

      The function POST and PATCH both call.

      15 min
    • Where the document is inserted

      The one call that writes to the notes collection.

      12 min
    • Where the list is fetched

      The effect in the list screen.

      14 min
    • Where the error text is kept

      The state that holds the message from the server.

      16 min
    • File names that match the feature

      A person can find notes routes and the notes screen without a map.

      12 min
    • Accounts are a later feature

      You can name them, and they are not mixed into this one.

      15 min
  15. 15. Explain the feature

    • Four sentences for the feature

      What it stores, which routes, which screens, and what the client does not decide.

      18 min
    • Draw browser to database and back

      React sends the request, Express handles it, and MongoDB stores the document.

      13 min
    • Point at the blank title

      The check, the 400, and the message beside the field.

      17 min
    • Point at a failed list request

      What the screen says, and what it does not invent.

      11 min
    • Where the id comes from

      The database assigns it, a bad id is 400, and an unknown id is 404.

      16 min
    • Where the connection string lives

      On the server, and not in the React bundle.

      14 min
    • What you left out on purpose

      No accounts in this feature, and you can say why.

      15 min
    • Add a note and refresh

      The title is still on the list because the document was stored.

      12 min

Lecture videos stay with the course. Playback for enrolled students will open once payments are available. Video links are not published on this page.