Product Analysis: MERN Stack
Overview
MERN is a fullstack implementation based on MongoDB, Expressjs, React/Redux, and Nodejs. It is a JavaScript/Node-based framework for fullstack web development. The MERN stack allows for seamless integration between the front-end and back-end of web applications.
Features
- MongoDB: A NoSQL database that provides scalable storage for data in a JSON-like format.
- Expressjs: A web application framework for building APIs and handling server-side applications.
- React/Redux: A JavaScript library for building user interfaces and managing state.
- Nodejs: A JavaScript runtime that allows for server-side execution of JavaScript code.
- Fullstack Web Development: MERN offers a complete solution for building web applications, from the database to the front-end UI.
- JWT Authentication: MERN supports JSON Web Token (JWT) authentication, allowing users to securely access protected API endpoints.
- Client-Server Communication: MERN enables seamless communication between the client-side and server-side components of a web application.
- Deployment to Heroku: MERN provides a guide for deploying the server to the Heroku cloud platform.
Installation
To install and run the MERN stack on your machine, follow these steps:
Prerequisites:
- MongoDB
- Node ^10.0.0
- npm
Clone or download the project structure.
Client-side usage (PORT: 3000):
- Run
npm install
to install the required dependencies. - Make sure the client and server run concurrently in different terminal sessions to enable communication between them.
- Run
Server-side usage (PORT: 8000):
- Run
npm install
to install the required dependencies. - Prepare your secret by adding a JWT_SECRET in the .env file to connect to MongoDB.
- Run the script at the first level.
- Run
Deploy Server to Heroku:
- After creating a Heroku app, update the file of client/webpack.prod.js if using webpack, or client/.env.production if using parcel.
Dependencies (tech-stacks):
- Client-side: axios: ^0.15.3, babel-preset-stage-1: ^6.1.18, lodash: ^3.10.1, react: ^16.2.0, react-dom: ^16.2.0, react-redux: ^4.0.0, react-router-dom: ^4.2.2, redux: ^3.7.2, redux-thunk: ^2.1.0.
- Server-side: bcrypt-nodejs: ^0.0.3, body-parser: ^1.15.2, cors: ^2.8.1, dotenv: ^2.0.0, express: ^4.14.0, jwt-simple: ^0.5.1, mongoose: ^4.7.4, morgan: ^1.7.0.
Summary
MERN stack is a powerful and efficient framework for fullstack web development. It combines MongoDB, Expressjs, React/Redux, and Nodejs to provide a seamless integration between the front-end and back-end of web applications. With features such as JWT authentication and client-server communication, MERN stack simplifies the development process and enables the creation of robust, scalable, and secure web applications.