What is MERN?
The MERN stack is a set of frameworks and tools used for developing a software product. They are very specifically chosen to work together in creating a well-functioning software (see a MERN app code at the post bottom).
Examples that are widely used in today’s web development:
- MERN (MongoDB, ExpressJS, ReactJS, NodeJS)
- LAMP (Linux, Apache, MySQL, PHP)
- MEAN (MongoDB, ExpressJS, AngularJS, NodeJS)
Let’s focus on MERN
- MongoDB: A document-oriented, No-SQL database used to store the application data.
- NodeJS: The JavaScript runtime environment. It is used to run JavaScript on a machine rather than in a browser.
- ExpressJS: A framework layered on top of NodeJS, used to build the backend of a site using NodeJS functions and structures.
- ReactJS: A library created by Facebook. It is used to build UI components that create the user interface of the single page web application.
Film Hall Application
Tech Stacks used:
- React.js
- Node.js
- Express
- Mongoose
- Redux
- Bootstrap
Project Structure
- Frontent
- actions//dispatch CRUD actions to reducer (global state)
- api//fetch or axios to handle communication with server
- reducers//handle data fetched from server
- components//Using Functional based component
- Backend
- controller//handle http requests from frontend
- models//mongoose modeling
- router//RESTful Api routing
Advantages
- Amazing Global state management using Redux.
- Really fast user experiences.
- Clear project structure.