Full Stack web development is gaining traction in IT industry as it allows developers to create a full fledged application from creating a simple web page to making it live on the internet. It requires knowledge of different technologies.
This guide covers the what, why, and how, required to start the MERN stack development.
What does MERN stand for?
MongoDB, Express.js, React.js & Node.js
What is MERN Stack ?
MERN is a technology stack used to develop a full-stack software application.
A technology stack is basically a set of frameworks and tools which facilitate the development of an application.
MERN stack laverages below frameworks/tools for creating full-stack applications:-
- MongoDB is the database layer for the full-stack application used to store and manage data.
- It is an open-source, NoSQL, document based database which stores data in the binary JSON format.
- It is highly scalable and can be used to store large volumes of data.
2. ExpressJS Framework
- ExpressJS is open source, unopinionated, lightweight framework built on top of NodeJS.
- You can use Model, View & Controller (MVC) pattern to create server-side applications.
- React is declarative, efficient and flexible for building user interfaces.
- It allows you to compose complex user interfaces from small and isolated, reusable pieces of code called components
- It is fast, scalable and offers code reusability.
- Express.js framework is built on top of Node.js to facilitate web development.
- Node.js hosts thousands of public/private packages via NPM to facilitate application development over multiple domains.
Why should you learn MERN Stack ?
Are there other tech stacks ?
- MEAN Stack (MongoDB, ExpressJS, AngularJS & Node)
- MEVN Stack (Angular replaced by Vue.js)
- LAMP Stack (Linux, Apache, MySQL & PHP)
- Rails + React.js and many more.
Pre-requisites for learning MERN Stack
- Basic knowledge of Unix commands
- Good understanding of HTML/CSS concepts
- Basics of MongoDB is a plus.
You can learn more about the concepts you need to learn before starting MERN here.
Various layers of MERN Stack
MERN Stack applictaions follows a 3 layer architecture pattern which is based on a typical MVC model.
1. Client layer(Views)
- These are views(webpages) which is visible to the client.
- On this layer, end users tries to access the feature of our application.
2. Application Layer(Controllers)
- This is the business logic layer which is an Express application on top of Node.js platform.
- This application server acts as the bridge of communication between client & database layer.
- This layer accepts client's requests and serves them by fetching appropriate data from database layer.
3. Database Layer(Models)
- Database layer runs the mongoDB server.
- All application data is stored in this mongoDB database.
How does MERN Stack work ?
In a full-stack MERN application, the client layer(React application) which is accessible by the end users makes request for web pages. These requests go to the application server which is the logical layer. It determines what data/web-pages a client needs and makes request to database(database layer) for fetching this informtaion. Finally the backend server(application layer) passes required data/web-pages to React application which renders the data on web-page for the clients.
Let's walk through a scenario to understand the working of MERN stack applications.
Register user for an application
- React application(client layer) displays a registration form on a webpage.
- End user fills the form and submits required data for registration.
- The user data is transferred from client to server(application layer) over http.
- Server receives the data and validates user's credentials.
- After validation, server sends user data to be saved into database(database layer).
- After success/failure confirmation from database, server sends a response to react over http.
- Based on success/failure, react application displays an appropraite message to client.
Roadmap for learning MERN Stack and becoming a full stack developer
There after, we can proceed to individual platforms/libraries based on the chosen stack.
A full-stack MERN developer should be prolific in different technologies like
- Database Management(MongoDB)
- Version Control(Git)
- Operating Systems(linux/Mac/Windows)
How long does it take to learn MERN stack ?
- Node.js Fundamentals(1 week)
- ExpressJS & MongoDB Database(3-5 weeks)
- React Fundamentals(2-3 weeks)
For understanding the advanced concepts of ReactJS like Context API, State management using Redux & React hooks, It may take additional 2 to 3 weeks.
It may take around additional 8-10 weeks to grasp the fundamentals.
- HTML/CSS(3-4 weeks)
So, in total it will take between 18-30 weeks to become a full-stack developer on MERN stack, starting from absolute scratch.
Our program at AltCampus takes you all the way from zero to a full-stack employable MERN developer in about 6 months of time.
What is the salary of a MERN Stack developer ?
The salary of a full stack developer depends on 3 different factors.
The average salary of a full stack developer varies across different continients.
The average starting full-stack developer salary in India is around ₹589,578 or $7800, and that in the United States is around $86,121.
Since MERN stack is the most popular and widely used among all stacks for full-stack development, the average salary in India is around ₹723,000 or $9717.
How to learn MERN Stack ?
The key to learning MERN stack development is to follow a systematic step by step approach for major concepts in a specific order.
- Start with Node.js
- Learn key concepts, work on few small projects
- Move to mongoDB, learn to use the database
- learn Express, create small CRUD applications
- Use MongoDB database with Express application
- Learn to create REST APIs using Express & MongoDB
- Learn React, make small Todo application
- Learn how to manage state in React and fetch data from APIs
- Use REST API to fetch data and render components by building say a shopping cart frontend in React.js
- Lastly, create full stack applications like Blog App, Bookstore etc.
If you are just starting out your developer journey, checkout our course for a detailed, step by step process which includes Videos, Assignments, Projects & Feedback Videos for Assignments etc. It is for absolute beginners who are new to programming and needs no prior knowledge of programming.
What are some key concepts to learn in MERN Stack ?
MERN Stack is built of 4 robust technologies i.e. MongoDB, Express.js, React.js and Node,js.
To be a MERN Stack developer, one should have working knowledge of all the above technologies.
Here's an article detailing key concepts to learn in MERN Stack.
What are some MERN stack beginner projects that you can build to learn ?
While learning individual technologies(Node/Express, React), you can create small projects like -
- Todo App(Express)
- Photo Gallery(Express)
- Instagram clone(React)
- Movies catalog(React) etc.
to grasp smaller detailed concepts.
A MERN application involves both frontend and backend along with database to create a full stack application.
A full stack developer needs to figure out the UI, create backend APIs which can serve data to fronend application, integrate it with the database for managing application data, think of different ways data could be saved for faster processing and all possible CRUD applications.
Few full stack MERN projects which a beginner developer can start with are:
1. Personal Project Management Tool
- This project can help you gather all your learning projects in one app. You can use MongoDB database for storing all project details like project name, details, url link, github repository etc.
- Using React, create webpages where you can list all the projects.
- Express application linked to mongoDB database can serve data to React application
2. Public Blog App
Create a blog application where users can
- Login/Signup to the application
- Create articles
- View list of all the articles
- Edit/Delete his/her own articles
- Add categories, tags and filters to list blog page
- Follow other article authors
- Favorite/like articles
- Add comment to the articles
3. Social Media App for local handicrafts
Social media app where people can connect with other people, view local handicrafts being created in the area, share their own crafts and creatives, etc.
What are the best MERN stack courses and bootcamps?
There are a lot of tutorials online to learn MERN stack.
The MERN Fullstack Guide on Udemy
Checkout freeCodeCamp It has all the resources available free to kick start the MERN Fullstack Journey.
Checkout Full-Stack Web Development with React Specialization by Coursera in collaboration with The Hong Kong University
Most of these courses have good video content but they lack a strong feedback mechanism which could track students progress on a daily/weekly basis. They have community but you need to wait hours to get a response.
Take a look at our AltCampus full-stack MERN course.
AltCampus is an online programming bootcamp designed to help you learn full-stack web development and become job-ready. It is 100% online, Project based and provides unparalleled learning support at each step of learning.
Take a look at the AltCampus Curriculum. It has 14 modules, 80+ topics to learn, 200+ exercises for practice and more than 40 projects to strengthen your portfolio.
It's a 6 month immersive program which provides:-
- Step by step content from scratch with timeline to complete it
- Exercises and projects after each topics to practice concepts
- Feedback videos for exercises to learn best practices and cement concepts learnt
- 24*7 Community Support using Slack
- Major projects as Checkpoints inside each module to test entire module concepts
You can additionally upgrade to avail:-
- one-to-one mentor review & feedback for each Checkpoints(Major projects)
- Daily Doubt Clearing Session at fixed time
- Cohort or Self paced learning where each cohort has fixed size of max 10 students
- Live sessions weekly for important concepts
- Bi-weekly hackathons to work on your idea and build something useful
Is MERN stack production ready and scalable ?
Yes, MERN stack is production ready as well as massively scalable.
You can deploy a full-stack MERN application easily on all big platforms like AWS, DigitalOcean as well as heroku(for small applications).
You can even deploy them indivisually as frontend(React App) and Backend(Express App) separately on these platforms.
They even have managed services exclusively for deploying Node/React based applications.
MongoDB database which is used to store MERN stack application data is massively scalable as it can scale horizontally by adding multiple database servers as per application requirements.
MongoDB also supports replication which can provide high availability of data all the time.
Most fequently asked MERN stack interview questions
- What is Event loop & how it manages tasks in Node ?
- What is blocking code ? Give examples to differentiate it from non-blocking code.
- What is callback hell & how to avoid this ?
- Explain important features of MongoDB ?
- What is the difference between association and referencing in MongoDB ?
- What are Indexes and how are they helpful ?
- What is prop drilling in react and way to avoid it ?
- Explain virtualDOM ?
- What are Higher Order Components ?
- Differnece between smart and dumb components ?
- Explain lifecycle method and their sequence of execution ?
- Explain React Context API ?
Here's an article detailing frequently asked MERN stack interview questions.
What are the MERN stack developer jobs ?
As a MERN stack developer, you will be assigned one or multiple of given stacks to work with.
It could be as
- Frontend developer
- Backend developer
- Full stack developer(Frontend + Backend)
- Database administrator
- Deployment and tesing
1. Frontend Developer
- As a frontend developer, you will be creating UI components using React.
- Fetch data from backend using APIs
- Use redux for state management
- You will have to design website layouts using HTML/CSS
- Create smaller, reusable components using React
2. Backend Developer
- Create APIs using node/express for serving it to client(React application)
- Integrate Express app with mongoDB database
- Design data models for storing application data in mongoDB
- Secure Express server and mongoDB database
- Develop login for different features in the Express application like
- User Authentication
- Access rights for different users
- Managing static assets and multimedia files
- hashing sensitive information in the database
- Ensuring validation for data being saved in the database
- Add appropriate routes for different actions made by the client to server relevent data
3. Database Admin
- Securing the database
- Providing access rights to different database users
- Replication for high availability
- Scheduled Backup in case of database crash
4. Full Stack Developer
As a Full Stack developer, you might have to work on all of the above technologies simuntaneously.
You may have to create an entire application from the scratch which will require you to
- Create UI components using react in Frontend
- Design Database Models for applicatio data
- Setup Database for saving applicatio data
- Develop logic in backend & create API routes to serve data to client based on events
- Connect Frontend with Backend application
- deploy application on the remote server(AWS, Digitalocean, Heroku)
- Host application on a domain
What are some of the most popular companies using MERN stack?
There are hundreds of companies which have been developed using MERN stack technology. A few widely popular ones are:-
Things to prepare before applying for MERN Stack Developer Job
- Create a personal portfolio Website listing all your experiences and projects
- Add 2-3 good MERN projects to your portfolio which should be live on some url.
- Showcase your Github Projects
- Solve DS & Algo problems to develop strong logic using Codewars, HackerRank, Codechef etc..
- Checkout Interview Questions for MERN Stack Developers
- Contribute to the open-source MERN projects
Where to find MERN stack jobs ?
There are several job portals where you can find Fullstack MERN job opportunities.
- AngelList is the #1 startup hiring platform
- Stack Overflow Jobs
- Apply at Glassdoor
- Apply at Indeed
MERN stack vs MEAN stack ?
MEAN stands for MongoDB, ExpressJS, AngularJS & Node MERN stands for MongoDB, ExpressJS, React & Node
The difference is:
- MEAN Stack uses AngularJS for creating frontend UIs
- MERN Stack uses ReactJS in place of AngularJS for frontend UIs.
There are other differences as well:-
React uses virtualDOM which facilitates smooth rendering and it also enforces minimal chages in the UI based on the changed state by comparing virtualDOM with actual rendered component. It helps application to render only the thing which is changed from previous page.
React offers better productivity compared to Angular as we can easily create small, reusable components once and use it multiple times in same or other applications.
Angular has bidirectional data flow which in case of larger applications makes it harder to track the source of data changes. There would be a lot of actions which would mutate data all the times. In React, data flow is unidirectional and only certain actions can change the data present in the store. This will save the data from unnecessary mutations and it can be easily tracked.
React is more suited for Native mobile app development whereas we can not use Angular for this.
According to the 2019 HackerRank Developer skills report, Angular was the most popular choice of a web framework that programmers knew in 2018. This changed in 2019, the same report found that 30% of developers in 2019 wanted to learn the React framework, making it the most popular.
The lack of backward compatibility between Angular 2 and Angular 1 seems to have adversely impacted the popularity of Angular as both have their own learning curve.
That's a wrap up on the ultimate guide to MERN stack. Happy learning.