Computer Programming | Education

MERN stack

This question might hit you several times whenever you come across any topic related to web development. The reason is that, now MERN stack is in boom for web developers. This is not the only stack through which you can develop a website, there are several stacks available. Some of them are MEAN, LAMP, Ruby on Rails, Meteor, Java + spring etc. The conclusion of this blog is not to discourage anybody for choosing stack other than MERN related to web development. It totally depends on your choice.

So let’s start discussing what actually a MERN stack is. Before discussing this we have to understand what is a stack (in context of web development)? A stack is nothing but a set of tools from which we could develop a website. The term, ‘stack’, refers to the fact that the system’s individual components are built upon one another. The basic requirements necessary to construct a web stack include: an operating system, a webserver, a database, and a script interpreter.

The beauty of this stack is that you can make a website single handedly with JavaScript.

So we understood stacks, now we can differentiate MERN stack among rest of the stacks. MERN stands for M-mongoDB, E – expressJS, R – react, N – nodeJS.

1. MongoDB :-

What a MongoDB is? MongoDB is a NoSQL type database in which you can store your data much easier with high scalability. Some of the features of this database are:-

  • Support ad hoc queries
  • Indexing
  • Replication
  • Duplication of data
  • Load balancing
  • Supports map, reduce and aggregation tools
  • Uses JavaScript instead of procedures
  • It is a schema less database written in c++
  • Provides high performance
  • It’s also supports
    • JSON data models with dynamic schemas
    • Auto-sharing for horizontal scalability
    • Built in replication for high availability

Due to these features, it is widely used to improve performance of our projects. The question is, how we can integrate this database with our program. Since it uses JavaScript, we can integrate it with our node application via Mongoose. Mongoose is nothing but a library used to integrate ExpressJS and MongoDB. You can now feel why this stack is in boom, because there is already a framework or library to solve a problem. You can read further about MongoDB in it’s official documentation :- https://www.mongodb.com/blog/post/revamp-of-mongodbs-documentation

2. ExpressJS :-

For building server side of a website, we use ExpressJS. We can also do this via plain JavaScript, but it would create a mess for developers to handle all the server based requests on their own. The community of JavaScript evolved a new framework called ExpressJS which made this work easy and straightforward. You can easily write server side code to handle requests with very easy syntax by using this library. There are many libraries available for this task but ExpressJS is widely used. This is one of the most famous frameworks on JavaScript. By using this you can create REST API to function a CRUD application. There are n number of things you can do with ExpressJS as this framework is very flexible to integrate almost all kind of libraries or frameworks. For reading more about ExpressJS, I prefer you to check its official website :- https://expressjs.com/en/5x/api.html

3. React :-

Developed by Facebook, React is by far the most interested topics for front end frameworks. In today’s scenario for becoming a front-end web developer, only HTML and CSS are not enough.

We need to make use of front-end frameworks like AngularJS, VueJS or ReactJS.

React is used for client-side development. Through React we can improve the user interactivity. Before this the web site was supposed to reload the whole page, which was uncomfortable for the user. But using react, we can only replace the changed components in a page.

One thing to note here is that the websites created by React is often called single-page-application. It is because, React does not let the whole page to reload instead it only changes the components which are needed to be reloaded. The rest of the components remain as it is.

Actually the React saves the current DOM (Document-object-model) of HTML page into its memory. And whenever there is a change, React checks the current changed DOM of the page with the previously saved DOM of the same page. It replaces only the changed part on both of these DOMs (this is termed as rendering in React). So it’s like applying a patch.

After learning React, there are number of libraries which can improve the complexity of the code.

As the project’s size increases, maintaining the code becomes harder. So to make it easier some developers use Redux for it. Redux is a library to maintain the state (another React term) of a Component. Redux is not made exclusively for React! Rather it was made for itself. But if we integrate Redux with React, the program becomes much simpler and easy to manipulate the data.

This is a brief introduction to React. There is a lot of things in React to discuss. But for now let’s discuss only about MERN stack.

For reading more about react go through this link : https://reactjs.org/docs/getting-started.html

For Redux go here : https://redux.js.org/tutorials/index

If you are also wondering what is KALI LINUX checkout our post on Kali Linux

How to install Kali Linux:

bloggerboy-poster

4. NodeJS :-

Now comes the most important part of this stack, NodeJS. NodeJS is not a framework, library or a language. This is a common confusion among the beginners. It’s a runtime environment for JavaScript, which makes it easier for us to use JavaScript locally. Earlier JavaScript was only for animation in HTML or CSS and was only scoped inside the browser. But now the time has changed. JavaScript has a very big community. The scope of this language is almost everywhere. It’s not just a language for front end development. You can also handle the server side of the website. It’s also used in AI, ML etc.

Now coming to NodeJS, it is considered the most important discovery in scope of JavaScript. It’s the only thing which let the JavaScript community to grow in millions. It’s also correct to say that by the development of NodeJS, everyone is taking JavaScript seriously.

So what does NodeJS do in MERN stack? As mentioned earlier it is used to create an environment in which you can put all of the code and integrate it efficiently. As all the things are in JavaScript, the integration becomes much smoother and effective. For getting more information go here :-https://nodejs.org/en/docs/

I hope now you are aware about MERN stack. One thing to note here is that we don’t require an extra language to build a website, only JavaScript is enough. That’s the power of JavaScript. This was a brief introduction about MERN stack and its parts.

How do we start then? I would advise you to start reading documentation first. The reason is, after reading any documentation (or blog), it creates an overview of the technology which helps you to understand the correct use of it. Then you can start working on learning these skills through courses on Udemy or YouTube.

But if you are very new in web development, start with HTML and CSS first. And also try to know the working of internet and websites as these things will let you understand the basic functionality of websites.

One thing I want to say is that the learning path may seem boring at first, but as you move forward and make projects on your own, believe me you’ll love it!

So that’s all from my side!

Happy learning…..

Leave a Reply