What is MEAN?

A free video tutorial from Maximilian Schwarzmüller
AWS certified, Professional Web Developer and Instructor
66 courses
3,370,880 students
Lecture description
What does "MEAN" stand for? Let's explore the different pieces (MongoDB, Express, Angular & Node.js) that make up the MEAN stack and let's see WHY we combine them.
Learn more from the full course
Angular & NodeJS - The MEAN Stack Guide [2025 Edition]
Learn how to connect your Angular Frontend to a NodeJS & Express & MongoDB Backend by building a real Application
12:39:59 of on-demand video • Updated January 2025
Build real Angular + NodeJS applications
Understand how Angular works and how it interacts with Backends
Connect any Angular Frontend with a NodeJS Backend
Use MongoDB with Mongoose to interact with Data on the Backend
Use ExpressJS as a NodeJS Framework
Provide a great user experience by using Optimistic Updating on the Frontend
Improve any Angular (+ NodeJS) application by adding Error Handling
English [CC]
-: So what does mean stand for? What are the different components we'll learn about in this course? Mean comprises a set of four technologies and this is what it stands for. The M stands for MongoDB and it's the database will use in this course. So the part where we will be able to persist the data the users of our application generate like the user data itself but also like posts or messages they send, things like that. E stands for express and express js is hard to understand without the N. So let's quickly fast forward. We also get the A and A stands for Angular. Now I'll come back to that N, which is related to the E but Angular is our client side technology. It is a JavaScript framework in the end which we will use to render a nice dynamic UI user interface to our users. It runs entirely in the browser, not on the server at all and therefore it really has just one job presenting a nice and pleasant interactive and reactive user interface. Now what's the N then? Well, you probably already saw that something's missing. We got a database and we got something running in the browser but we certainly also need to run some logic on the server. For example, authenticating users. This is not something we can do in the browser because A, browser code can easily be hacked or changed, and B, it's way too complex. It would take up quite a significant amount of resources and slow down our front end our user interface, N stands for node js and it's the JavaScript run time the server side language will use in this course for our server side code. So for our core business logic that runs on the server and now the E is related to it because whilst node js is the language we'll use on the server, express is a framework for node js that makes working with it easier. You wouldn't need express JS per se, but it makes working with it much easier just as Angular is a framework for JavaScript in the browser. You don't need it, but it makes things easier. But let's take a more detailed look at all these things. Now wanna look at Angular first. As I already said, Angular runs on the client side in the browser. It's framework building up on JavaScript or using JavaScript, and it's used to create so-called single page applications. This essentially means that it handles the entire front end logic. So everything your user is going to see Angular is responsible for it, but I'll come back to it in a few seconds. Angulars job is to render the user interface with dynamic data. And that dynamic data part is important. Of course, its job is not just to render some static HTML and some CSS. We wouldn't need JavaScript for that. Its job is to update UI. Whenever we have new information let's say when you created a new post, we want to immediately update UI to show that new post there. It also is responsible for handling user input so validating that user input and also sending it to the server because that's the third part it does. It communicates with our backend. So with that node express Mongo combination that seems to be responsible for that. Angular provides a mobile app like user experience because since we handle everything in the browser through JavaScript, we never need to reload the page. We just change parts of the page with JavaScript through Angular, and therefore everything happens instantly in a very reactive way. And that is the feeling we know from mobile apps. Now, that is still only the front end though, as I said node JS is the language we're going to use for the back end. So on the server side, which we all build in this course node JS is a server side library, JavaScript runtime and you know that JavaScript can run in the browser while node js simply takes it adds some things that are useful on the server like working with files, working with http requests and now we can use JavaScript on the server too. Pretty amazing, node js listens to incoming requests and is able to send back responses. For example our Angular app could send a request to fetch a list of all the posts and node could handle it request do something, reach out to the database and send back a response with all these posts. Node js executes server side logic in general. So authentication, anything we don't want to run in the browser for security or performance reasons. And node js is able to interact with databases and files. Angular can't do this. It doesn't have access to any file system and especially not to a file system on some remote machine on a server. And whilst theoretically you could connect to a database from Angular since all your client side JavaScript code is visible to users, you can have a look at it in your developer tools of your browser. It would be very insecure to connect your database there because you would expose all your credentials and everything. You don't wanna do that. Therefore, node js is an alternative to PHP if you know that or Ruby on the Rails, asp.net, things like that. And it's rarely used standalone, just like these languages. You typically use a framework along with it and that framework you typically use is express. Express is a node JS framework. So it still uses node js, the same language but it adds a lot of utility features. So it offers additional functionalities or in general it makes things easier. Express JS is middleware based and we'll see what this means once we dive into the code. It basically funnels incoming requests through a chain of middlewares of steps where we can do something with the request, read some data from it, manipulate it check if the user is authenticated or basically sent back a response immediately. This chain allows us to write very structured code and you will learn everything about it in this course of course. And last, but at least it includes routing which means we could render views. So HTML pages with it. We're not going to do this in this course though because Angular should handle our entire front end. And again, this is all something we'll see. But more importantly we can handle different requests to different endpoint which will be important for connecting Angular to the backend because if we wanna fetch a list of posts we wanna send some requests to /posts. So our domain/posts, if we want to create a new post we want to send a different request to our domain/post, for example. And express JS allows us to implement this routing logic so that different requests to different URLs are handled correctly. Again, this will all be implemented step by step throughout the course. So to sum it up, express JS simplifies the usage of no js. It is a tool we definitely want to use. If you have a PHP background, for example you could compare it to Laravel for PHP, it makes things easier. There's one thing missing and that is MongoDB. Of course, MongoDB, as I already said, is a database. It's a noSQL database to be precise and it stores so-called documents in so-called collections. Now chances are you might have heard about SQL databases like my SQL, Microsoft SQL where you have records rows, which you store in tables. Now, noSQL has a different logic than SQL databases but in general it's still a database. So you store your application data on a server so that it persists across page reloads across the user, leaving your page, things like that. So any data that is not just temporary data definitely has to be stored in such a database. Now that noSQL thing means that this kind of database enforces no schema. So you can have different documents with different pieces of information in the same table or collection as it is called here. And it also doesn't really work with relations. You will see in this course that we can kind of relate different documents with each other, but in general, it's way less strict and flexible regarding relations than a SQL database is. And noSQL database is more about storing multiple unstructured documents though you can get some structure into it and we will actually do that in this course. I'll come back to what exactly MongoDB is and how it works in the respective sections. No worries. Now last but not least, it's easily connected to Node. That's pretty cool. It's very easy to integrate or node express to be precise and we don't connect it to Angular. I already said this. Theoretically you could find a way but you don't wanna do that because you don't want to expose your database credentials in your browser site code which can easily be viewed by the user. It's accessible in the developer tools of the browser. So MongoDB is a powerful database which can easily be integrated into a node express environment. And it's very popular these days because it's very flexible and it's highly scalable. It's able to handle a large amount of throughput. So requests per a second or write actions per a second and read actions per a second and will dive deeper into this in the sections where we start working with it. Now you could theoretically replace it with a different database. You could use a SQL database in a node express Angular application too. You're not limited to MongoDB and just wanna really emphasize this. I'm using MongoDB because it's part of this popular means stack and it has some advantages but depending on the application and the type of data you're storing if it's a data with a lot of relations maybe a SQL database might be better. And whilst we will use MongoDB in discourse I just wanna highlight this is not a must. You could use any database here. The core logic will dive in realistic connection of angular and node. So with that, let me quickly come back to what exactly that single page application thing meant and how the big picture of such a mean app looks like before we start diving into our setup of the course and start building our mean app.