🎓 A1Learner
🔍
0 of 50 lessons completed

Setting Up a MERN Project

Setting up a MERN project creates the folders and files for the app. This lesson builds the layout the whole course uses.

Check Node.js

This command prints the Node.js version.

node --version

Make the folders

This command creates the client and server folders.

mkdir -p mern-notes/client mern-notes/server

The server package file

This file lists the packages for the server side.

{
  "name": "server",
  "type": "module"
}

Example

console.log(process.version);
console.log('Node.js is ready.');

Key points

  • A MERN project has two sides, a client and a server.
  • The client folder holds the React app.
  • The server folder holds the Express code and the database code.
  • npm installs the packages each side needs.
  • A package.json file lists the packages for one side.

In this example, process.version holds the Node.js version. The first line prints that version. The second line prints a short message. The output shows Node.js v24.22.1 is ready.

Note

The project folder is named mern-notes in every example in this course.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

Which folders does a MERN project need?