Nishant Final Report
Nishant Final Report
Bachelor of Technology
in
Computer Science & Engineering
Submitted by
Nishant
04296302721
May/June 2025
DECLARATION
This is to certify that the material embodied in this Internship Report titled “Internship
Programme” being submitted in the partial fulfillment of the requirements for the
award of the degree of Bachelor of Technology in Computer Science and
Technology is based on my original work. It is further certified that this Internship
work has not been submitted in full or in part to this university or any other university
for the award of any other degree or diploma. My indebtedness to other works has
been duly acknowledged at the relevant places.
Nishant
04296302721
II
CERTIFICATE FROM THE COMPANY
III
CERTIFICATE FROM THE INSITIUTE
This is to certify that the work embodied in this Internship Report titled “Internship
Programme” being submitted in the partial fulfillment of the requirements for the
award of the degree of Bachelor of Technology in Computer Science and
Technology, is original and has been carried out by Nishant(04296302721) under my
supervision and guidance.
It is further certified that this Internship work has not been submitted in full or in part
to this university or any other university for the award of any other degree or diploma
to the best of my knowledge and belief.
IV
ACKNOWLEDGEMENT
Any project work owes its prosperity from beginning to fulfilment, to individuals
included with various aspects of it at different stages. Through this section I would
like to offer my sincere gratitude to each one of the individuals who made a
difference in the different phases of this study
Last but not least, this acknowledgement will remain incomplete if I fail to express
our deep sense of obligation to my parents and God for their consistent blessings and
encouragement.
Nishant
(04296302721)
V
ABSTRACT OF PROJECT
The web development industry has seen remarkable growth alongside the evolution of
technology. As software rapidly advances in tandem with hardware, internet
connected devices with real-time capabilities have become pervasive, making
performance optimization crucial. Despite many developments, some traditional
systems still struggle to meet modern performance demands. In the world of news
consumption, existing platforms like major news websites and social media channels
offer vast amounts of content, but they also present challenges like information
overload, making it difficult for users to find relevant news efficiently.
MERN, which stands for MongoDB, Express, React and Node.JS is a popular stack
for building full-stack web applications. In this project, React will be used to build a
dynamic and responsive user interface, while Express and Node handle server-side
requests and API integration.
This work serves as a valuable reference for novices and technology enthusiasts
seeking insights into the MERN stack.
VI
LIST OF FIGURES
VII
TABLE OF CONTENTS
Acknowledgement v
Abstract of Project vi
1.3. Conslusion 10
2.1.1. HTML 14
2.1.2. CSS 15
2.1.3. Bootstrap 16
2.1.5. Git 19
2.1.6. Github 22
2.1.7. MongoDB 25
VIII
2.1.8. ReactJS 27
2.1.8.1. Virtual-DOM 27
2.1.8.2. Component 27
2.1.9. Postman 28
2.1.10. MVC 29
2.1.11. Node.JS 31
2.1.12. Express.JS 33
5. Chapter 5- Conclusion 55
6. Chapter 6-Summary and Learning 60
7. Chapter 7 – Bibliography 61
IX
CHAPTER 1 - Company Profile
10
Project-Based Learning: Hands-on implementation of MERN
applications through real-world projects.
The training at Regalien not only enhances technical skills but also prepares
professionals for real-world software development challenges by integrating
industry best practices in software engineering.
1.4 Conclusion
With a commitment to continuous learning and professional growth, It ensures that
its trainees emerge as proficient full-stack developers, capable of contributing
effectively to modern software development projects.
11
CHAPTER 2
TECHNOLOGY TOOLS USED
2.1.2 Types
12
A front-end developer architects and develops websites and applications using web
technologies (i.e., HTML, CSS, DOM, and JavaScript), which run on the Open Web
Platform or act as compilation input for non-web platform environments
Back-End Development
Backend development consists of a server that provides the data and links upon
request; it channels the data and organizes the information in the database. Backend
development is the development of the server-side logic that works for websites and
apps behind the scenes to establish communication between the database and the
browsers.
● Python– It’s a widely used language with simple syntax and easy-to-read
code (almost close to English). Google uses it for the backend services. It has
a wide range of Frameworks like Django, Pyramid, and Flask.
● PHP– It’s the first priority when flexible accessibility is concerned. Highly
used in developing the backend of news websites and search engines
● Java– It is most popular due to its high scalability. Java brings the concept
of multi-threading, which can handle multiple requests independently and
efficiently
13
● SQL (Structured Query Language)- This is where our database is used for
analysis and manipulations.There are many uses of SQL as it is an excellent
tool for performing complex Operations on the Data.
2.2.1. HTML
HTML, or Hypertext Markup Language, is a standard markup language used for
creating and designing web pages. It structures content on the web, defining elements
such as headings, paragraphs, links, images, and more.
14
Types of HTML:
o HTML 4.01: Released in 1999, it was the fourth major version and
widely used for a long time.
o XHTML: An XML-based HTML reformulation, combining HTML with
XML syntax.
o HTML5: The latest and widely adopted version, introduced in 2014,
focuses on enhancing multimedia support, APIs, and providing a more
consistent syntax.
15
2.1.2 CSS
CSS, or Cascading Style Sheets, is a style sheet language used to describe the
presentation of a document written in HTML or XML. It controls the layout,
formatting, and appearance of elements on a web page, enhancing the visual appeal
and user experience.
Types of CSS:
Inline CSS: Applied directly to an HTML element using the “style” attribute.
Internal or Embedded CSS: Defined within the HTML document using the
<style> tag in the document’s head.
External CSS: Defined in a separate CSS file and linked to the HTML
document using the <link> tag.
CSS Versions:
CSS1: The initial version, defining basic styling properties.
CSS2: Introduced more capabilities, including positioning and media types.
CSS2.1: An updated version with corrections and clarifications.
CSS3: The latest version, modularized to allow gradual adoption of new
features. It includes modules for various styling aspects, such as selectors,
colors, and animations.
CSS plays a crucial role in web development by separating content from presentation,
facilitating consistent styling across multiple pages and devices. Its continuous
evolution reflects the dynamic nature of web design and the need for enhanced styling
capabilities.
16
2.1.3 Bootstrap
Bootstrap is a popular open-source CSS framework designed for responsive, mobile-
first web development.
Features
Bootstrap is a web framework that focuses on simplifying the development of
informative web pages (as opposed to web apps). The primary purpose of adding it to
a web project is to apply Bootstrap's choices of color, size, font and layout to that
project. As such, the primary factor is whether the developers in charge find those
choices to their liking. Once added to a project, Bootstrap provides basic style
definitions for all HTML elements. The result is a uniform appearance for prose,
tables and form elements across web browsers. Bootstrap also comes with several
JavaScript components in the form of jQuery plugins.
17
Fig 2.6: Bootstrap advantages
● Bootstrap is a free front-end framework for faster and easier web development
● Bootstrap includes HTML and CSS based design templates for typography,
forms, buttons, tables, navigation, modals, image carousels and many other, as
well as optional JavaScript plugins
● Bootstrap also gives you the ability to easily create responsive designs.
18
Key Features of Tailwind CSS:
Dark Mode Support: Easily toggle between light and dark themes.
19
2021 (v3.0) – Introduced Just-In-Time (JIT) engine by default for faster builds
and more flexibility.
2022–2024+ – Continued growth with plugin ecosystem, container queries,
and framework integrations.
2.1.5. JavaScript
JavaScript is a versatile, high-level programming language primarily used to create
dynamic and interactive content on websites. It runs in the browser, enabling client-
side functionality such as form validation, animations, and real-time updates without
reloading the page. JavaScript supports object-oriented, functional, and event-driven
programming styles. It can manipulate HTML and CSS using the DOM (Document
Object Model). Modern JavaScript (ES6+) includes features like arrow functions,
promises, async/await, and modules. JavaScript is also used on the server-side with
environments like Node.js. Its vast ecosystem and community make it one of the most
popular and essential languages for web development.
20
JavaScript Framework:
React.js – Library for building user interfaces, especially SPAs (Single Page
Applications).
Angular – Full-featured MVC framework developed by Google.
Vue.js – Lightweight and flexible framework for building UIs and SPAs.
Svelte – Compiles components to efficient vanilla JavaScript at build time.
Next.js – React-based framework for server-side rendering and static site
generation.
Nuxt.js – Vue-based framework similar to Next.js for SSR and SSG.
2.1.6 React
React is a popular open-source JavaScript library developed by Facebook for
building dynamic and interactive user interfaces, particularly for single-page
applications (SPAs). It follows a component-based architecture, where UIs are built
by combining reusable components, each managing its own state and logic. React
uses a virtual DOM to efficiently update and render components, resulting in high
performance and a smoother user experience.
React is widely used in modern web development due to its flexibility, large
ecosystem, and support for server-side rendering (using Next.js), mobile app
development (with React Native), and component reusability.
21
Features of React.js
Component-Based Architecture – Build UIs using reusable, independent
components.
Virtual DOM – Efficiently updates and renders only changed parts of the UI.
Declarative Syntax – Describes what the UI should look like for easier
maintenance.
JSX Support – Allows mixing HTML with JavaScript for readable and
expressive code.
Unidirectional Data Flow – Ensures predictable data handling and easier
debugging.
Hooks API – Enables state and lifecycle management in functional
components.
High Performance – Optimized rendering through virtual DOM and smart
diffing.
Strong Ecosystem – Integrates well with tools like Redux, React Router, and
Next.js.
Cross-Platform Support – Use React Native to build mobile apps using the
same principles.
Server-Side Rendering – Supports SSR for better SEO and faster page loads
(e.g., with Next.js).
Workflow of React.js
22
2.1.7. Node.JS
Node.js is an open-source, cross-platform JavaScript runtime built on Chrome’s V8
engine that allows developers to run JavaScript on the server side. It is event-driven
and non-blocking, making it ideal for building scalable, high-performance web
applications. Node.js is commonly used for backend development in full-stack
applications, especially in the MERN stack. It supports asynchronous programming,
handles concurrent connections efficiently, and excels in building REST APIs, real-
time applications, and microservices. With its vast package ecosystem (npm),
developers can access thousands of modules to speed up development. Node.js
enables JavaScript to be used across both frontend and backend, simplifying full-stack
workflows.
Features of Node.JS
Asynchronous and Non-blocking I/O – Handles multiple requests without
waiting for any.
Single-Threaded Event Loop – Efficiently manages concurrent connections
with a single thread.
Built on Chrome’s V8 Engine – Offers fast code execution and performance.
Cross-Platform – Runs on Windows, macOS, and Linux.
NPM (Node Package Manager) – Provides access to thousands of reusable
libraries and modules.
Highly Scalable – Ideal for building scalable network applications.
Real-Time Capabilities – Supports real-time applications like chat and
gaming apps.
Modular Architecture – Encourages reusable and maintainable code.
Supports JSON and REST APIs – Seamlessly handles data exchange in web
applications.
Used for Full-Stack Development – Works well with frameworks like
Express and databases like MongoDB.
23
Components of Node.JS
Single-Threaded Event Loop – Handles multiple requests efficiently with
one thread.
Event-Driven Model – Uses events and callbacks for asynchronous
operations.
Non-Blocking I/O – Performs I/O without blocking the main thread.
V8 Engine – Executes JavaScript code at high speed.
Libuv Library – Manages the event loop and thread pool.
Event Queue – Stores incoming requests to be processed.
Thread Pool – Handles heavy or blocking operations in the background.
Modules System – Enables modular code using CommonJS or ES Modules.
Request-Response Cycle – Processes client requests and sends responses
asynchronously.
Cross-Platform Support – Works on major operating systems like Windows,
macOS, and Linux.
2.1.8. Express.js
Express.js is a fast, minimal, and flexible Node.js web application framework used
for building server-side applications and APIs. It simplifies the process of handling
HTTP requests, routing, middleware integration, and managing server logic. Built on
top of Node.js, Express provides a robust set of features for building single-page,
multi-page, and RESTful web applications. It uses middleware functions to process
requests and responses, making the code modular and maintainable. Express supports
various templating engines, routing patterns, and HTTP methods, making it ideal for
both simple and complex applications. It is widely used in full-stack development,
especially in the MERN stack (MongoDB, Express, React, Node). Its simplicity, vast
middleware ecosystem, and seamless integration with databases and frontend
frameworks make Express.js one of the most popular choices for backend
development in modern JavaScript applications.
24
Fig 2.13: Express.js Logo
Features of Express.js
Minimal and Lightweight – Provides core web server features with minimal
overhead.
Fast Routing System – Handles HTTP methods and URL paths efficiently.
Middleware Support – Allows request processing through layered
middleware functions.
Template Engine Integration – Supports engines like EJS, Pug, and
Handlebars.
RESTful API Support – Ideal for building RESTful web services and APIs.
Error Handling – Built-in mechanism for managing errors and exceptions.
Flexible and Extensible – Easily integrates third-party packages and custom
middleware.
Asynchronous Handling – Uses non-blocking I/O for high performance.
Robust Community and Ecosystem – Large number of plugins and
resources available.
Works Seamlessly with Node.js – Built on Node.js for efficient backend
development.
2.1.8 MongoDB
MongoDB is an open-source database; it is also the leading NoSQL (*) database
currently used by millions of people. It is written in one of the most popular
programming languages today.
NoSQL is a source database format that does not use Transact-SQL for regular access
information, this database was developed on JavaScript Framework on JSON(ob) data
type. With its introduction, it has overcome the disadvantages of RDBMS relational
type data model to improve operating speed, functionality, model scalability ,cache .
25
Fig 2.14: MongoDB Logo
Working of MongoDB
MongoDB is a NoSQL, document-oriented database designed for high performance,
scalability, and flexibility. Instead of storing data in traditional rows and tables like
relational databases, MongoDB stores data in JSON-like documents called BSON
(Binary JSON). Each document is a collection of key-value pairs, which allows for a
dynamic schema—meaning different documents in the same collection can have
different structures.
When a client (like a Node.js server) sends a request to MongoDB, the database stores
or retrieves documents from collections, which are analogous to tables in relational
databases. MongoDB uses a schema-less model, so developers can insert any type of
document without predefining its structure.
It supports powerful querying, indexing, and aggregation pipelines for efficient data
retrieval and manipulation. MongoDB scales horizontally using sharding
(distributing data across multiple servers) and ensures high availability through
replication (maintaining copies of data across servers). This makes it ideal for
modern applications requiring real-time analytics and large-scale data storage.
In the MERN stack, MongoDB acts as the backend database where all user data, app
data, and content are stored and accessed by the Node.js/Express server through
drivers like Mongoose, which provides a structured way to define and interact with
the database.
26
Fig 2.15: MongoDB work-flow
Features of MongoDB
Document-Oriented Storage – Stores data in flexible, JSON-like
BSON documents.
Schema-Less Design – Allows dynamic structure for documents
within a collection.
High Performance – Optimized for fast read/write operations.
Scalability – Supports horizontal scaling through sharding.
Replication Support – Ensures high availability with replica sets.
Powerful Query Language – Supports rich queries, filters, and
aggregation pipelines.
Indexing – Allows indexing on any field for faster search.
Integrated File Storage – Uses GridFS to store and retrieve large
files.
Cross-Platform Compatibility – Runs on Windows, Linux, macOS,
and cloud platforms.
Strong Community and Ecosystem – Wide range of tools, drivers,
and integrations available.
MongoDB Atlas:
MongoDB Atlas is a cloud-based database service offered by MongoDB Inc.
that provides a fully managed version of MongoDB. It allows developers to
deploy, manage, and scale MongoDB clusters on major cloud platforms like
AWS, Google Cloud, and Azure without manual configuration. Atlas handles
backups, monitoring, updates, and security automatically. It offers features
like built-in data replication, global distribution, real-time performance insights,
and end-to-end encryption. MongoDB Atlas is ideal for modern applications
needing high availability, scalability, and minimal maintenance. It also
27
supports easy integration with the MERN stack, allowing cloud-hosted
MongoDB databases to be accessed via Node.js applications using
Mongoose
2.1.9. Mongoose
Mongoose is an Object Data Modeling (ODM) library for MongoDB and Node.js that
provides a structured and schema-based way to interact with MongoDB databases. It
acts as a bridge between the MongoDB database and the Node.js application by
allowing developers to define data models using schemas. These schemas define the
structure, data types, validation rules, and relationships of documents within a
MongoDB collection, which helps in maintaining data consistency and integrity.
Mongoose simplifies CRUD (Create, Read, Update, Delete) operations with a clean
and expressive API. It supports middleware (also called pre and post hooks), which
allows execution of custom logic before or after database operations like saving or
deleting documents. It also includes built-in data validation, query building,
population for managing relationships, and support for custom instance and static
methods.
In the MERN stack, Mongoose is typically used on the server side to define how
application data is stored and retrieved from MongoDB. It makes working with
MongoDB in Node.js much easier, especially when building RESTful APIs or
handling user data.
28
Working of Mongoose
Mongoose works by creating a structured interface between a Node.js application and
a MongoDB database. It allows developers to define schemas, which act as blueprints
for the structure of documents in a MongoDB collection. These schemas specify
fields, data types, default values, validation rules, and relationships. Once a schema is
defined, it is compiled into a model, which is used to create and manage documents in
the database. When the application performs operations like saving, finding, updating,
or deleting data, Mongoose translates these actions into MongoDB queries behind the
scenes. It also provides powerful features such as middleware (to run functions before
or after operations), virtuals (computed properties), and population (for handling
references between collections). By enforcing consistent data structures and
simplifying database interactions, Mongoose makes it easier to build robust and
maintainable backend applications in the MERN stack.
Benefits of Mongoose
Schema-Based Structure – Defines clear data models for MongoDB
collections.
Data Validation – Ensures data integrity with built-in validation rules.
Simplified Queries – Provides an easy and readable API for database
operations.
Middleware Support – Allows execution of logic before or after actions like
save or delete.
Relationship Management – Supports population to handle referenced
documents.
Reusable Models – Enables consistent and modular use of data structures
across the app.
Built-in Type Casting – Automatically converts data to correct types based
on schema.
Query Helpers – Supports custom instance and static methods for cleaner
code.
Default Values – Allows setting default values for fields during document
creation.
Integration with Node.js – Works seamlessly with Express and other Node.js
tools
29
Mongoose is an ODM (Object Data Modeling) library that runs on Node.js
and helps developers define schemas, validate data, and perform database
operations easily.
30
2.2.1. Postman
Postman is a popular API testing and development tool used by developers and testers
to design, test, and debug APIs. It allows users to send HTTP requests to a server and
view the responses, supporting all HTTP methods like GET, POST, PUT, DELETE,
etc. Postman provides features like environment variables, authentication, request
chaining, and automated testing. It also offers a user-friendly interface to organize
collections of requests, monitor API performance, and collaborate with teams. With
integrations for CI/CD pipelines, Postman simplifies the API development workflow
and ensures robust, error-free API communication.
Features of Postman:
Environment Variables – Use variables for different environments like dev,
staging, and production.
Automated Testing – Write test scripts to validate API responses.
Request Collections – Organize and save groups of API requests.
API Documentation – Generate and share interactive API documentation.
Mock Servers – Simulate server responses for testing purposes.
Collaboration – Share and collaborate on collections and environments with
teams.
Monitor APIs – Set up monitors to track API performance over time.
Request Chaining – Pass data between requests for sequential testing.
Integrations – Integrates with CI/CD tools for automated API testing.
31
the server completes the task, it sends a response back to the client in the form of
JSON data.
Thus, the client and software communicate in a request-response model using REST
APIs, making the app dynamic and interactive. This seamless interaction defines the
full-stack architecture of the MERN stack.
32
Fig 2.21: client and database relation
Cursor: This is a pointer to the outcome set of a query. The client can emphasize over
a cursor to get the result.
Database: The location of the collections, similar to the RDMS database that contains
the tables. Each Database has a separate file stored on physical memory. Some
MongoDB owners may contain various databases.
Field: A name-value pair in a document. A document may not need all the fields. The
fields are like columns in a relational database.
JSON: Short for JavaScript Object Notation. Human readability is in the plain text
format representing structured data. JSON currently supports a lot of programming
languages.
33
Index: Exclusive data structures used to save a small allocation of data sets for simple
scanning. The index puts the value of an individual field or sets of fields, sorted by the
value of these fields. Index effectively supports the analysis of queries.
2.2.3 GIT
Git is a free and open-source distributed version control system used to track changes
in code during software development. It allows multiple developers to collaborate on
the same project, manage different versions of the code, and merge contributions
efficiently. Git stores the full history of changes, supports branching and merging, and
enables rollback to previous states. Developers can work offline and later sync their
changes with remote repositories like GitHub or GitLab. Its speed, reliability, and
powerful features make Git an essential tool in modern development workflows,
including those in full-stack projects like the MERN stack
34
git log – Shows the commit history.
git remote -v – Displays remote repository URLs.
git reset <file> – Unstages a file.
git rm <file> – Deletes a file and stages the deletion.
git config – Sets Git configuration values (like username, email).
Features of GIT
Distributed Version Control – Every user has a full copy of the
repository history.
Branching and Merging – Supports feature branches and smooth
integration of code.
Lightweight and Fast – Performs operations quickly and efficiently.
Data Integrity – Ensures data is stored securely using SHA-1 hashing.
Offline Work – Most Git operations can be done without an internet
connection.
Staging Area – Allows control over which changes to commit.
Collaboration Support – Enables multiple developers to work
simultaneously.
Undo Capabilities – Allows rollback to previous versions safely.
Open Source – Free to use and supported by a large community.
Integration Friendly – Works well with platforms like GitHub, GitLab,
and Bitbucket.
2.2.3 GitHub
GitHub is a web-based platform that provides Git version control hosting and
collaboration features for developers. Built on Git, it enables developers to store,
manage, and share their code repositories, making it a central hub for open-source and
private projects. GitHub allows developers to collaborate by providing features like
branching, pull requests, and merging, enabling multiple people to work on the same
project without conflicts.
Developers can create repositories, track issues, and discuss code changes through
issues and comments. GitHub also offers a visual interface to track commit histories
and contributions, making it easier to manage and review code changes.
GitHub's community and collaborative features have made it a go-to platform for
35
open-source projects, and its integration with tools like GitLab and Bitbucket further
strengthens its position in the software development ecosystem
GitHub work-flow
36
Features of GitHub
Code Hosting – Stores and manages Git repositories in the cloud.
Version Control – Tracks changes and manages project history using
Git.
Branching and Merging – Allows separate feature development and
safe integration.
Pull Requests – Facilitates code reviews and collaboration before
merging changes.
Issue Tracking – Helps manage bugs, tasks, and feature requests.
GitHub Actions – Automates workflows like testing, building, and
deployment.
Project Management Tools – Includes boards, milestones, and labels
for organizing work.
Collaboration – Enables team discussions, comments, and code
suggestions.
Access Control – Manages permissions for team members and
contributors.
GitHub Pages – Hosts static websites directly from repositories.
Code Review Tools – Inline comments and change suggestions for
efficient reviews.
Integration Support – Works with CI/CD, IDEs, and third-party tools.
Open Source Support – Hosts millions of public open-source projects.
Security Features – Offers dependency alerts, secret scanning, and
branch protection.
The View is responsible for presenting the data to the user, typically through a user
interface, and reflects any changes made to the data.
The Controller acts as a bridge between the Model and View—it processes user
inputs, calls the appropriate functions in the Model, and determines which View to
render as a response. This separation of concerns makes the code more organized,
maintainable, and scalable.
In modern web development, including the MERN stack, MVC helps manage
complexity by clearly defining responsibilities: for instance, Mongoose manages
Models, React handles Views, and Express handles Controllers. This structured
approach improves code clarity, enables easier debugging and testing, and facilitates
teamwork by allowing developers to work on separate components independently
37
Fig 2.24: MVC Pattern Architecture
38
Fig 2.25: MVC Pattern work-Flow
39
2.2. MUI
Material UI is an open-source React component library that implements Google’s
Material Design. It includes a comprehensive collection of prebuilt components that
are ready for use in production right out of the box. Material UI is beautiful by design
and features a suite of customization options that make it easy to implement your own
custom design system on top of our components. Material UI v5 supports Material
Design v2. Adoption of v3 is tentatively planned for Material UI v6—see the release
schedule. You can follow this GitHub issue for future updates.
40
Material-UI is a widely-used React UI framework that provides a set of React
components implementing Google's Material Design principles. It offers a
comprehensive and customizable collection of components, ranging from
buttons and forms to complex data grids and navigation elements.
Advantages of MUI
Rich Component Library – Offers a wide range of pre-built UI components.
Customizable Themes – Easily supports theming and custom styles.
Responsive Design – Built-in responsive layout support.
Material Design Compliance – Adheres to Google’s Material Design
guidelines.
Developer-Friendly – Simple API with excellent documentation.
Integration Ready – Easily integrates with React and other libraries.
Performance Optimized – Lightweight and fast rendering components.
Accessibility Support – Follows best practices for accessible UI.
Active Community – Backed by a large and active open-source community.
41
CHAPTER -3
DEMONSTRATION OF PROJECT
Definition
The backend is powered by Node.js and Express.js, which handle all server-
side logic, including user registration, authentication, and routing. RESTful
APIs are built to interact with the frontend and database, facilitating actions like
user login, product retrieval, order placement, and admin management.
MongoDB serves as the NoSQL database for storing all application data—
users, products, orders, and reviews. It allows flexibility in data modeling and is
connected through Mongoose, which provides schema-based solutions and easy
querying.
Security is enforced using JWT (JSON Web Tokens) for user authentication,
along with bcrypt for password hashing. Role-based access control ensures that
only admins can access sensitive routes. The application includes features like
search and filter, cart and wishlist management, and payment gateway
integration for end-to-end shopping functionality.
42
ADVANTAGES:
43
3.1 Why MERN Stack ?
44
Fig 3.1: Data Flow in MERN Stack
Because we are using MERN in all the stack it will help at faster and easier
development of full-stack applications. MERN stack is a technology that is a user-
friendly full.
It significantly reduces boilerplate code and enhances developer productivity with its
auto-configuration capabilities. Its ability to handle scalable microservices
architectures and built-in support for monitoring, configuration, and security make it
an excellent choice for enterprise-grade applications. Its distributed architecture and
commit log mechanism provide durability and reliability, making it ideal for
streaming scenarios where the timely and consistent delivery of messages is critical.
3.2 Authentication
Authentication in a MERN Stack application involves a secure and efficient process
of verifying user identities using technologies like JWT (JSON Web Tokens),
bcrypt, and middleware in Node.js/Express.js. When a user registers or logs in
through the React.js frontend, their credentials are sent via HTTP POST requests to
the backend server built with Node.js and Express.js. The server first validates the
data and uses bcrypt to securely hash passwords before storing them in the
MongoDB database via Mongoose. Upon successful login, the server generates a
JWT, which contains encoded user information and is signed using a secret key. This
token is then sent back to the client and stored—typically in localStorage or
45
httpOnly cookies—to maintain the user's session. For any subsequent requests that
require user authentication (such as viewing orders or adding items to the cart), the
client sends the token in the request header. A middleware function on the server
verifies the token using JWT verification, ensuring that only authenticated users can
access protected routes. Additionally, role-based access control (RBAC) can be
implemented by including user roles in the token payload and verifying them in
middleware before granting access to admin-specific functionalities, such as
managing products or orders. This stateless, token-based system ensures both security
and scalability, making it highly suitable for e-commerce platforms like House of
EM5, where protecting user data and ensuring seamless access is critical
Types Of Authentication
Password-Based Authentication
Users log in using a unique username/email and password combination. It's the
most common type but less secure if not combined with other methods like
hashing or 2FA.
Biometric Authentication
Uses unique physical traits like fingerprints, facial recognition, or iris scans.
Commonly used in mobile apps and modern security systems.
Session-Based Authentication
The server creates a session and stores it (often in a cookie) after login. The
session ID is used to authenticate the user during the session duration.
46
Fig 3.2: Types of authentication
Producer
In this project we have used JWT-Token based authentication. Which have following
below steps for its implementation.
47
User Model – models/User.js
48
Auth Middleware – middleware/authMiddleware.js
49
3.4 Authorization
Authorization in Node.js refers to the process of determining what resources
or actions a user is allowed to access after they have been authenticated.
While authentication confirms a user's identity (e.g., via login), authorization
controls access based on user roles or permissions.
In a typical Node.js application using Express.js, authorization is handled via
middleware functions that check the authenticated user's role or privileges
before allowing access to specific routes.
50
Role-Based Authorization Middleware – middleware/authorizeRole.js
51
3.5 Synchronous Processing
52
How Synchronous Code Work:
JavaScript reads and executes code from top to bottom.
Each line of code waits for the previous line to finish.
Only one operation runs at a time (single-threaded).
Blocking tasks halt the execution of all following code.
Useful for simple and quick operations like calculations or printing.
No code is skipped or run in parallel.
It follows a predictable and linear execution model.
Long-running synchronous code can freeze the UI in browsers.
The JavaScript call stack processes one function at a time.
Synchronous code is easier to debug due to clear execution flow.
53
Fig 3.6: Asynchronous Processing
Working of Asynchronous Processing
JavaScript sends asynchronous tasks to the browser or Node.js APIs.
It continues executing the next lines without waiting for the task to
finish.
Long-running tasks (like fetch, setTimeout) run in the background.
When the task completes, its callback or result is moved to the callback
queue.
The event loop monitors the call stack and callback queue.
If the call stack is empty, the event loop pushes the callback to the
stack.
The callback is then executed, completing the asynchronous operation.
Promises and async/await simplify writing asynchronous code.
It avoids blocking the main thread, keeping the app responsive.
Ideal for I/O tasks like API calls, database queries, and timers.
54
Summary Table of Async VS Sync
55
CHAPTER-4
RESULTS OF THE PROJECT
Landing Page
56
Sign-up Page
Login Page
57
You observed that:
Application performance improved.
Code became more maintainable.
The system remained responsive under high message loads.
It demonstrated how modern MERN Stack tools can dramatically simplify and scale
performance of web Development.
58
CHAPTER 5- CONCLUSION
The project started with setting up the basic structure, including building the frontend
with React for a dynamic user interface and implementing backend REST APIs using
Express.js for secure user authentication and data handling. I also integrated JWT-
based authentication for secure login and registration, ensuring role-based access
control for both users and admins.
To enhance the user experience, I focused on optimizing the performance of both the
frontend and backend, ensuring smooth interactions even with a growing catalog of
products. The final product not only met the functional requirements but also
provided a responsive and scalable platform for future growth.
59
CHAPTER 6- SUMMARY AND LEARNING
The project started with the creation of a simple UI of the website and a
synchronous single-threaded consumer, developed using React,js and Node.js,
a rapid application development platform. This basic setup helped me
understand the fundamental working of authentication using jwt in backend,
However it is further used to authenticate the validity of the user and provide
additional security.
60
BIBLIOGRAPHY
61