Nodejs
Nodejs
Seminar Report
On
Node.js Framework
In partial fulfillment for the award of the degree
Of
BACHELOR OF COMPUTER APPLICATION
[B.C.A]
Year 2023-2024
SUBMITTED BY: GUIDED BY:
Vishruti R. Malaviya Prof. Anahita Pithawala
BCA-6th SEMESTER
Submitted to:
pg. 1
Node.js Framework December 30, 1899
Acknowledgement
S1
pg. 2
Node.js Framework December 30, 1899
Index
pg. 3
Node.js Framework December 30, 1899
Abstract
pg. 4
Node.js Framework December 30, 1899
1.History
1.1 Overview
Node.js is an open-source, cross-platform JavaScript runtime environment that executes
JavaScript code server-side. It is built on the V8 JavaScript runtime engine, which is the same
engine that powers the Google Chrome browser. Node.js allows developers to use JavaScript
for server-side scripting, enabling the development of scalable and high-performance network
applications.
Node.js was created by Ryan Dahl and was first released in 2009. Dahl aimed to
develop a server-side technology that could provide low-latency and high-
throughput applications by using non-blocking, event-driven I/O.
npm was introduced as the package manager for Node.js. It quickly became a
vital part of the Node.js ecosystem, allowing developers to share and reuse code
easily.
Joyent, a cloud computing company, took over the stewardship of Node.js. Ryan
Dahl's role in development gradually diminished, and Isaac Schlueter became the
lead maintainer.
Node.js version 0.8 was a significant release that introduced the Streams API,
enhancing the handling of data streams in applications.
pg. 5
Node.js Framework December 30, 1899
In a landmark move, the Node.js and io.js communities reconciled, leading to the
formation of the Node.js Foundation. This reunification aimed to consolidate
efforts and resources for the benefit of the entire Node.js ecosystem.
Node.js 4.0 was released as the first LTS version, signaling a commitment to
providing stable and reliable releases for an extended period. LTS versions are
supported for 30 months.
Node.js 6.0 introduced several new features and performance improvements. The
Node.js project adopted a predictable LTS schedule to facilitate planning for
enterprises and developers.
Node.js 10.0 was released, bringing new features and improvements. The
Node.js Foundation joined forces with the JS Foundation to create the OpenJS
Foundation, which aimed to promote the growth and sustainability of JavaScript
and web technologies.
Node.js 12.0 was a major release introducing experimental support for Worker
Threads, enabling developers to run JavaScript code in parallel threads for
improved performance.
Node.js 14.0 became the new LTS version, bringing enhancements and
improvements. Additionally, Node.js 15.0 was released, targeting developers
who wanted to experiment with the latest features.
Node.js 16.0 was released, featuring updates and improvements. The Node.js
community continued to grow, with a focus on enhancing performance, security,
and developer experience.
pg. 6
Node.js Framework December 30, 1899
2.Introduction
Node.js is an open-source and cross-platform JavaScript runtime environment. It is a
popular tool for almost any kind of project!
Node.js runs the V8 JavaScript engine, the core of Google Chrome, outside of the
browser. This allows Node.js to be very performant.
A Node.js app runs in a single process, without creating a new thread for every
request. Node.js provides a set of asynchronous I/O primitives in its standard library
that prevent JavaScript code from blocking and generally, libraries in Node.js are
written using non-blocking paradigms, making blocking behavior the exception rather
than the norm.
When Node.js performs an I/O operation, like reading from the network, accessing a
database or the filesystem, instead of blocking the thread and wasting CPU cycles
waiting, Node.js will resume the operations when the response comes back.
Node.js has a unique advantage because millions of frontend developers that write
JavaScript for the browser are now able to write the server-side code in addition to the
client-side code without the need to learn a completely different language.
In Node.js the new ECMAScript standards can be used without problems, as you don't
have to wait for all your users to update their browsers - you are in charge of deciding
which ECMAScript version to use by changing the Node.js version, and you can also
enable specific experimental features by running Node.js with flags.
Event-driven architecture:
Node.js allows developers to use JavaScript for both client-side and server-side
scripting. This uniformity simplifies development and promotes code reusability.
Node.js comes with npm (Node Package Manager), a vast ecosystem of open-
source libraries and modules that simplify the development process. Developers
can easily leverage existing packages or share their own.
Scalability:
Cross-platform:
Community support:
Node.js has a vibrant and active community of developers who contribute to its
growth. This community support results in continuous improvements, updates,
and a wealth of resources for developers.
pg. 8
Node.js Framework December 30, 1899
V8 JavaScript Engine:
Libuv Library:
Core Modules:
Role: Node.js comes with a set of built-in modules that provide essential
functionalities for developers. These core modules cover a wide range of tasks,
from handling file systems to managing HTTP requests.
Role: npm is the official package manager for Node.js. It allows developers to
discover, install, and manage third-party packages (libraries and tools) for
their Node.js applications.
Event-driven Architecture:
pg. 9
Node.js Framework December 30, 1899
Functionality: Events are used to trigger actions, and event listeners handle
those actions. This architecture makes Node.js suitable for building scalable
and responsive applications.
Express.js (Optional):
Role: While not a core part of Node.js, Express.js is a popular web application
framework built on top of Node.js. Many developers use Express.js to simplify
the process of building robust and scalable web applications.
These components work together to provide a robust and efficient runtime environment for
server-side JavaScript development. Developers can leverage these components to build
scalable, high-performance applications, taking advantage of Node.js's event-driven and non-
blocking architecture.
pg. 10
Node.js Framework December 30, 1899
One of the key strengths of Node.js is its event-driven, non-blocking I/O model. This design
allows Node.js to efficiently handle numerous concurrent connections without resorting to
traditional multithreading. Asynchronous programming in Node.js enables developers to
initiate tasks and move on to other operations while waiting for I/O operations to complete.
This results in enhanced performance and scalability, making Node.js particularly well-suited
for applications that require real-time capabilities.
Node.js shines in scalability, making it an excellent choice for building applications that
demand handling a large number of simultaneous connections. Its event-driven architecture
and non-blocking I/O lend themselves well to scenarios like real-time applications, where
responsiveness is crucial. This scalability is complemented by Node.js's versatility,
supporting the development of various applications, including web servers, RESTful APIs,
and microservices.
The community surrounding Node.js is another driving force behind its success. The
community's active participation results in continuous improvements, regular updates, and an
abundance of documentation and resources. Developers benefit from a collaborative
environment where knowledge sharing and problem-solving are commonplace.
While Node.js itself provides a robust foundation, the Express.js framework, although not an
intrinsic part of Node.js, further enhances its capabilities. Express.js simplifies the
development of web applications by offering features like routing, middleware support, and
template engines.
In summary, Node.js has emerged as a favored choice for server-side development due to its
unification of JavaScript, efficient event-driven architecture, fast execution with the V8
engine, cross-platform compatibility through Libuv, a vast npm ecosystem, scalability, and an
pg. 11
Node.js Framework December 30, 1899
active community. Its flexibility and ability to handle asynchronous operations make it an
ideal platform for building modern, high-performance web applications and services.
pg. 12
Node.js Framework December 30, 1899
4.Architecture of Node.js
Node.js uses the “Single Threaded Event Loop” architecture to handle multiple
concurrent clients. Node.js Processing Model is based on the JavaScript event-based model
along with the JavaScript callback mechanism.
Now let’s understand each part of the Node.js architecture and the workflow of a web server
developed using Node.js.
Requests
Node.js Server
Node.js server is a server-side platform that takes requests from users, processes those
requests, and returns responses to the corresponding users
pg. 13
Node.js Framework December 30, 1899
Event Queue
Event Queue in a Node.js server stores incoming client requests and passes those requests
one-by-one into the Event Loop.
Thread Pool
Thread pool consists of all the threads available for carrying out some tasks that might be
required to fulfill client requests
Event Loop
Event Loop indefinitely receives requests and processes them, and then returns the
responses to corresponding clients
External Resources
External resources are required to deal with blocking client requests. These resources can
be for computation, data storage, etc.
pg. 14
Node.js Framework December 30, 1899
4.Example
4.1Example of Node js Application
In summary, these applications chose Node.js for its speed, scalability, and ability to
handle real-time features efficiently. Node.js's event-driven, non-blocking architecture
makes it well-suited for applications with a large user base and concurrent
connections, providing a responsive and high-performance user experience.
1.Netflix:
Lowers Startup time with Node.js
Netflix is the world’s biggest global provider of video streaming including movies
and television series, available in over 190 countries. As of July 2020, Netflix reported
over 192 million subscribers worldwide, with more than 72 million in the U.S itself.Until
2015, it was using a JAVA backend, which was useful for data management but offered
poor user-wait times. Since Javascript frontend didn’t communicate efficiently with the
JAVA backend, Netflix decided to move to Node.js to leverage the performance benefits
of node.js.
Monolithic application design made it hard to scale the application with the
growing user base.
The transition from the backend to the frontend was not smooth, resulting in
higher load time, often causing latency at the end-user level.
UI customization as per user needs was hard to achieve due to synchronous
loading.
JAVA’s bulky build time reduced development and deployment speeds.
A dramatic 70% lower startup time. Netflix interface that took 5-10 seconds
earlier, now just took a little over 1 second.
JAVA’s 40 minute startup time came down to 1 minute with Node.js.
The application became microservice oriented, making it easy to break up the UI
in smaller segments, rather than one large block.
As Node is also Javascript, the backend to frontend transition was significantly
improved.
2.Linkedin:
pg. 15
Node.js Framework December 30, 1899
It is available in 24 languages.
Linkedin, the world’s largest professional network, has more than 690 million
users. It is also one of the biggest apps that deploy Node.js in production.
LinkedIn uses Node.js to empower the server side of its mobile app.
LinkedIn chose Node.js for its speed and ability to handle multiple connections
simultaneously.
This is crucial for a platform with millions of users who may be accessing the service
concurrently.
Node.js app helped LinkedIn reduce their resource usage and improved app
performance.
LinkedIn was able to reduce the machines used to host their app by a ratio of
10:1.
The client and server both came under the Javascript regime, making it easier for
development teams to handle the client-server interaction.
The code was simplified across the board, making it more modular and less state-
dependent
3.NASA:
improve database access time with Node.js
NASA, the aeronautics pioneer, was facing difficulties in consolidating its dispersed
legacy databases related to EVA Spacesuits. It made it difficult for scientists to access
databases for research purposes. Data access was slow and required rummaging through
multiple locations to get the data for proper research.
Collin Estes, who designed the Node.js enterprise architecture for NASA, describes
how the system needed an API-driven architecture. When you ask which companies use
Node.js, you don’t expect NASA, but it’s true for the following reasons.
300% improvement in the time needed to access the database, allowing users to
get desired data sets in seconds and not hours.
The Node.js microservices architecture made it possible to move legacy
databases to the cloud and make them available to users via APIs.
The earlier 28-step database reading process came down to 7 steps with Node.js.
Scientific research is done with much greater ease in much less time.
Smooth connection of legacy Oracle and SQL Server databases to new cloud
databases via data API modules.
pg. 17
Node.js Framework December 30, 1899
5.Application
Data streaming:
Node.js provides a built-in stream module that allows you to work with streams.
Streams are objects that let you read or write data in chunks, rather than loading
the entire dataset into memory. There are several types of streams, including
Readable, Writable, and Duplex streams.
Iot Applications:
Node.js can be applied in the context of IoT, where it can handle the
communication between devices, process data from sensors, and interact with
other IoT components in a real-time and efficient manner.
Complex SPAs:
pg. 18
Node.js Framework December 30, 1899
building complex SPAs. It is small and easy to use, which makes it perfect for
making single-page apps.
REST stands for REpresentational State Transfer. REST is web standards based
architecture and uses HTTP Protocol. It revolves around resource where every
component is a resource and a resource is accessed by a common interface using
HTTP standard methods. REST was first introduced by Roy Fielding in 2000.
A REST Server simply provides access to resources and REST client accesses
and modifies the resources using HTTP protocol. Here each resource is identified
by URIs/ global IDs. REST uses various representation to represent a resource
like text, JSON, XML but JSON is the most popular one.
web applications:
Node.js is a versatile technology that can be utilized to build both the backend
and frontend components of web applications. It offers a consistent, JavaScript-
based development environment, making it easier for developers to work on both
sides of the application.
Real-time Chats:
Real-time chat is any online communication tool that enables the live
transmission of text, video, or audio messages from a sender to a receiver. Real-
time chats can take the form of one-to-one or one-to-many group chats built on
instant messaging (IM) or Internet Relay Chat (IRC) technologies.
pg. 19
Node.js Framework December 30, 1899
6.Comparative technology
=>Node.js vs Laravel
pg. 20
Node.js Framework December 30, 1899
=>Node.js vs Flask
pg. 21
Node.js Framework December 30, 1899
Most developers have a good grasp of JavaScript for it being one of the most popular
programming languages.
Developers who are already good in JavaScript find it easy to use Node.js at the
backend. It is quite easy to learn Nodejs and it also consumes lesser time.
High performance
With Node.js, both the server-side and client-side of an application can be written in
JavaScript, streamlining development and making it easier for developers to switch
between frontend and backend tasks.
With Node.js it becomes possible for developers to write the server-side application in
JavaScript. This means that when you hire node js developers they can write both
front-end and back-end applications in JavaScript using a runtime environment.
Fast Execution
Node.js is built on the V8 JavaScript engine, which compiles JavaScript code directly
into machine code, resulting in fast execution times. This makes Node.js well-suited
for handling I/O-bound operations and building high-performance applications.
Cross-platform
Enterprise Adoption
pg. 22
Node.js Framework December 30, 1899
In Node.js there are frequent API changes. API stands for Application
Programming Interface and it keeps on changing. Every new API comes with
backward-incompatible changes. This means that the developers will have to change
the code to make it compatible with the latest version of the Node.js API.
Compared to other languages, JavaScript does not have a robust and well-
equipped library system.
As a result, users are forced to take support from the commonly available library for
executing tasks, such as processing and handling database operations, Object-
Relational Mapping, XML parsing, etc.
This makes it difficult for developers to implement common programming tasks using
Node.js.
pg. 23
Node.js Framework December 30, 1899
9.Future enhancement
Deploying GraphQL:
Client apps can interact with data using the query language GraphQL. It is a
system that is not dependent on any specific data sources, therefore it does not matter
where the data is kept for the purposes of organizing its operations. It is regarded as
the most intriguing and widely used technology in app development.
Serveless no hardware:
It allows developers to concentrate on designing apps rather than maintaining
infrastructure. As a result, serverless benefits include more deployments, greater
flexibility and lower costs.
Real-Time Applications:
Real-time apps were quite popular. Real-time apps with high user involvement
deliver not only a plethora of fantastic features but also speed. These apps offer a
variety of features, such as gamification, social media integration, live chat, ad
servers, stock market functionality, and more. Node.js meets all of the ecosystem's
standards.
Internet of Things:
Node.js is a fantastic platform that JavaScript provides for building IoT apps.
To better capitalize on microservices, real-time capabilities, and data-centric
strategies, the bulk of well-known IoT organizations have already started employing
experts to develop Node. js-based IoT apps.
pg. 24
Node.js Framework December 30, 1899
Microservices:
If you want to create an enterprise-level project, microservices are a necessity.
They add several features to improve efficiency and debugging and support for server
outlook. In your project, Node.js enables easy access to and utilization of
Microservices. Microservices are popular because they generate serverless models,
which make large-scale applications easy to build.
Cloud Computing:
These days, moving to the cloud to improve performance and reduce expenses
is nothing new. Due to its serverless architectural feature, Node.js proved
tremendously efficient in building a cloud-based app. Google has made a number of
Node.js tools available to developers due to the popularity of Node.js. These
resources can assist you in developing cloud apps more quickly.
pg. 25
Node.js Framework December 30, 1899
10.Conclusion
Node.js is a fantastic programming framework that enables you to create products that can
hasten the expansion of your organization.
The two main characteristics to make Node.js the most sought-after platform in the future are
its high flexibility and scalability.
In addition, Node.js, which has a strong debugging approach, is a dependable way to meet the
changing needs of businesses and advance them.
To master this technology and tap into its immense potential, consider enrolling in
Knowledge Hut's Node.js course.
pg. 26
Node.js Framework December 30, 1899
10.References
https://www.simplilearn.com/understanding-node-js-architecture-article
https://www.simform.com/blog/companies-using-nodejs/
pg. 27