DEV Community

Cover image for JavaScript Full-Stack
Ian Iversen
Ian Iversen

Posted on

JavaScript Full-Stack

So... you know how to program your backend using Ruby and SQL. Is there any other way to build a backend? There certainly is!

In this blog post I will explore, MERN, a web development stack that only requires knowledge of Javascript and JSON.

Image description

What is MERN?

MERN is an acronym that stands for mongoDB, Express.js, React, and Node.js. In other words--the database, the backend framework, the frontend library and the runtime environment.

How does MERN work?

To understand how MERN works, we must take a more in depth look at each MERN element. Let's move through MERN back to front.

Node.js

First comes Node.js, without it, JavaScript would only be allowed to run in the browser. Node allows for JS to exist in our files and open-source packages, awaiting the signal to execute.

"Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on a JavaScript Engine and executes JavaScript code outside a web browser, which was designed to build scalable network applications." - Wikipedia https://en.wikipedia.org/wiki/Node.js

where did node come from?

In 2009, software engineer Ryan Dahl took built a runtime environment for JS outside of the browser using C++ and Google's V8 JS engine.

React

Second comes React, a JavaScript library that makes building a modern interactive front end easier. React allows for more dynamic and versatile applications through its ability to control state.

React can be run without Node.js, but if a developer wants to use dependent libraries, or dependencies, they must install them using node.

Express.js

Third: Express.js, which is used as our backend framework. Express.js allows developers to create a fully featured server using JavaScript.

Familiar JS syntax can be used in a developer's code editor.

Image description

mongoDB

Finally, we have MongoDB which is MERN's database.

It's a no-sequel and non-relational database. This means that the database is not immediately configured for SQL or strictly predefining datatypes. Mongo is structured using objects with key/value pairs.

Image description

The benefits to using MERN are:

  1. Large node ecosystem for open source libraries

  2. Constrains your web app to JS (React front end)

  3. MongoDB essentially uses JSON

Image description

Top comments (0)