MEAN Components

Go back to Tutorial

AngularJS (Client Side)

AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML’s syntax to express your application’s components clearly and succinctly. AngularJS data binding and dependency injection eliminate much of the code you currently have to write. And it all happens within the browser, making it an ideal partner with any server technology.

  • AngularJS is a powerful JavaScript-based development framework to create RICH Internet Application(RIA).
  • AngularJS provides developers options to write a client-side application (using JavaScript) in a clean MVC (Model View Controller)

AngularJS Architecture

Model –

  • It is the lowest level of the pattern responsible for maintaining data.
  • The model is responsible for managing application data. It responds to the request from view and to the instructions from the controller to update itself.

View

  • It is responsible for displaying all or a portion of the data to the user.
  • A presentation of data in a particular format, triggered by the controller’s decision to present the data. They are script-based template systems such as JSP, ASP, PHP and very easy to integrate with AJAX technology.

Controller

  • It is a software Code that controls the interactions between the Model and View.
  • The controller responds to user input and performs interactions on the data model objects. The controller receives input, validates it, and then performs business operations that modify the state of the data model.

NodeJS (Server Side)

Node.js is a server-side platform built on Chrome’s JavaScript runtime for easily building fast and scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

  • Asynchronous and Event Driven – All APIs of Node.js library is asynchronous, that is, non-blocking. It essentially MEANs a Node.js based server never waits for an API to return data. The server moves to the next API after calling it and a notification mechanism of Events of Node.js helps the server to get a response from the previous API call
  • Very Fast – Being built on Google Chrome’s V8 JavaScript Engine, Node.js library is very fast in code execution.
  • Single Threaded but Highly Scalable – Node.js uses a single threaded model with event looping. Event mechanism helps the server to respond in a non-blocking way and makes the server highly scalable as opposed to traditional servers which create limited threads to handle requests. Node.js uses a single threaded program and the same program can provide service to a much larger number of requests than traditional servers like Apache HTTP Server.
  • No Buffering – Node.js uses a single threaded model with event looping. Event mechanism helps the server to respond in a non-blocking way and makes the server highly scalable as opposed to traditional servers which create limited threads to handle requests. Node.js uses a single threaded program and the same program can provide service to a much larger number of requests than traditional servers like Apache HTTP Server.
  • Threading – Node.js operates on a single thread, using non-blocking I/O calls, allowing it to support tens of thousands of concurrent connections without incurring the cost of thread context switching. The design of sharing a single thread between all the requests that use the observer pattern is intended for building highly concurrent applications, where any function performing I/O must use a callback. In order to accommodate the single-threaded event loop, Node.js utilizes the libuv library that in turn uses a fixed-sized thread pool that is responsible for some of the non-blocking asynchronous I/O operations.

Architecture Description

  • Here “n” number of Clients Send request to Web Server. Let us assume they are accessing our Web Application concurrently.
  • Let us assume, our Clients Are Client-1, Client-2… and Client-n.
  • Web Server internally maintains a Limited Thread pool. Let us assume “m” number of Threads in the Thread pool.
  • Web Server receives those requests one by one.
  • Web Server pickup Client-1 Request-1, Pickup one Thread T-1 from Thread pool and assign this request to Thread T-1
  • Thread T-1 reads Client-1 Request-1 and process it
  • Client-1 Request-1 does not require any Blocking IO Operations
  • Thread T-1 does necessary steps and prepares Response-1 and send it back to the Server
  • Web Server in-turn send this Response-1 to the Client-1
  • Web Server pickup another Client-2 Request-2, Pickup one Thread T-2 from Thread pool and assign this request to Thread T-2
  • Thread T-2 reads Client-1 Request-2 and process it
  • Client-1 Request-2 does not require any Blocking IO Operations
  • Thread T-2 does necessary steps and prepares Response-2 and send it back to the Server
  • Web Server in-turn send this Response-2 to the Client-2
  • Web Server pickups another Client-n Request-n, Pickup one Thread T-n from Thread pool and assign this request to Thread T-n
  • Thread T-n reads Client-n Request-n and processes it
  • Client-n Request-n require heavy Blocking IO and computation Operations
  • Thread T-n takes more time to interact with external systems, does necessary steps and prepares Response-n and send it back to the Server
  • Web Server in-turn send this Response-n to the Client-n

If “n” is greater than “m” (Most of the times, it’s true), then server assigns Threads to Client Requests up to available Threads. After all m Threads are utilized, then remaining Client’s Request should wait in the Queue until some of the busy Threads finish their Request-Processing Job and free to pick up next Request. If those threads are busy with Blocking IO Tasks (For example, interacting with Database, file system, JMS Queue, external services, etc.) for a longer time, then remaining clients should wait a long time.

  • Once Threads are free in Thread Pool and available for the next tasks, Server pickup those threads and assign them to remaining Client Requests.
  • Each Thread utilizes many resources like memory etc. So before going those Threads from the busy state to waiting for the state, they should release all acquired resources

ExpressJs

Express provides a minimal interface for us to build our applications. It is minimal, providing us the absolutely required tools to build our app and flexible, there are numerous modules available on npm for express, which can be directly plugged into express.

Unlike its competitors like Rails and Django, which have an opinionated way of building applications, express has no “best way” do something. It is very flexible and pluggable.

Architecture Description – When the user sends a request to through AngularJS then that request is firstly accessed by the NodeJS threading is done in the NodeJS and then it is sent to the ExpressJS to Create, Read, Update and Delete the API for the Request. ExpressJs host the website for the NodeJS. Both NodeJS and ExpressJS are server-side languages. After CURD the API data is retrieved from the MongoDB and then send it to the User.

  • Create (POST) – Make something
  • Read (GET)_- Get something
  • Update (PUT) – Change something
  • Delete (DELETE)- Remove something

MongoDB

MongoDB (from humongous) is a free and open-source, cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. MongoDB is the database for today’s applications, enabling you to:

  • Leverage data and technology to maximize competitive advantage
  • Reduce risk for mission-critical deployments
  • Accelerate time-to-value
  • The dramatically lower total cost of ownership

We can build applications using MongoDB database without using traditional database relations(MYSQL). MongoDB features are below.

  • Fast, Iterative Development – A flexible data model coupled with dynamic schema and idiomatic drivers make it fast for developers to build and evolve applications.
  • Flexible Data Model – MongoDB’s document data model makes it easy for you to store and combine data of any structure, without giving up sophisticated validation rules, data access and rich indexing functionality.
  • Multi-Datacenter Scalability – As your deployments grow in terms of data volume and throughput, MongoDB scales easily with no downtime, and without changing your application.
  • Integrated Feature Set – Analytics and data visualization, text search, graph processing, geospatial, in-memory performance, and global replication allow you to deliver a wide variety of real-time applications on one technology, reliably and securely.

Architecture Description

  • Expressive query language & secondary Indexes – Users should be able to access and manipulate their data in sophisticated ways to support both operational and analytical applications. Indexes play a critical role in providing efficient access to data, supported natively by the database rather than maintained in application code.
  • Strong consistency – Applications should be able to immediately read what has been written to the database. It is much more complex to build applications around an eventually consistent model, imposing significant work on the developer, even for the most sophisticated engineering teams.
  • Enterprise Management and Integrations. – Databases are just one piece of application infrastructure and need to fit seamlessly into the enterprise IT stack. Organizations need a database that can be secured, monitored, automated, and integrated with their existing technology infrastructure, processes, and staff, including operations teams, DBAs, and data analysts. However, modern applications impose requirements not addressed by relational databases, and this has driven the development of NoSQL (non SQL”, “non-relational” or “not only SQL) databases which offer:
  • Flexible Data Model – NoSQL databases emerged to address the requirements for the data we see dominating modern applications. Whether document, graph, key-value, or wide-column, all of them offer a flexible data model, making it easy to store and combine data of any structure and allow dynamic modification of the schema without downtime or performance impact.
  • Scalability and Performance – NoSQL databases were all built with a focus on scalability, so they all include some form of shading or partitioning. This allows the database to scale out on commodity hardware deployed on-premises or in the cloud, enabling almost unlimited growth with higher throughput and lower latency than relational databases.
  • Always-On Global Deployments – NoSQL databases are designed for highly available systems that provide a consistent, high-quality experience for users all over the world. They are designed to run across many nodes, including replication to automatically synchronize data across servers, racks, and data centers.

Features of MongoDB

  • In MongoDB, data represents in a collection of JSON documents.
  • MongoDB’s querying is object-oriented, which MEANs you can pass MongoDB a document explaining what you are querying. MongoDB doesn’t support joints, it supports multi-dimensional data types like other documents and arrays.
  • MongoDB, you will only have one array of comments and one collection of posts within a post
  • One of the best things about MongoDB is that you are not responsible for defining the schema

Go back to Tutorial

Get industry recognized certification – Contact us

Menu