Major Project
Major Project
CSJM UNIVERSITY
IN FULFILMENT OF DEGREE OF
BACHELOR OF COMPUTER APPLICATION (BCA)
Session: 2021-2024
BY
YOUR NAME
CSJM Roll. No.
Project Guide
(Faculty)
ABS, Kanpur
Undertaken at:
Allenhouse Business School, Kanpur
Table of Contents
1. Introduction
- Background
- Objectives
- Scope
2. Literature Review
- Overview of E-commerce
- Key Technologies in Full Stack Development
- Previous Work and Case Studies
3. System Design
- Architecture Overview
- Database Design
- Frontend Design
- Backend Design
- Integration of Components
4. Implementation
- Frontend Development
- Backend Development
- Database Implementation
- Testing Approach
7. Security
- Data Encryption
- Secure Authentication
- Payment Security
8. Performance Optimization
- Frontend Optimization Techniques
- Backend Optimization Techniques
- Database Optimization
9. Deployment
- Hosting Environment
- Continuous Integration/Continuous Deployment (CI/CD)
- Scaling Strategies
11. Conclusion
- Summary of Achievements
- Future Directions
Introduction
Background
The landscape of commerce has undergone a significant transformation with
the advent of e-commerce. Traditional brick-and-mortar stores are increasingly
supplementing their operations with online platforms to reach a wider
audience and provide more convenient shopping experiences. In line with this
trend, the project aims to develop a comprehensive e-commerce web
application using the MERN stack.
Objectives
- To create a user-friendly and responsive e-commerce platform that enhances
the online shopping experience for customers.
- To implement robust backend functionalities for efficient inventory
management, order processing, and sales tracking.
- To leverage the scalability and flexibility offered by the MERN stack to ensure
seamless performance and easy maintenance.
- To provide a secure environment for both customers and store owners,
ensuring data confidentiality and transaction integrity.
Scope
The scope of the project encompasses the development of core e-commerce
functionalities, including user authentication, product catalog management,
shopping cart, checkout process, and order management. Advanced features
such as recommendation systems and social media integration will be
considered for future iterations. Non-essential features such as chatbots and
augmented reality product visualization are out of scope for the initial release.
Target Audience
The target audience for the e-commerce platform includes individuals of all
ages who prefer the convenience of online shopping. Special consideration will
be given to tech-savvy users who expect modern UI/UX designs and seamless
navigation. User personas may include professionals, parents, and digital
natives who seek hassle-free shopping experiences.
Project Category
The project falls within the realm of web development, specifically focusing on
the development of a Full Stack E-commerce Web Application. E-commerce, or
electronic commerce, refers to the buying and selling of goods and services
over the internet. With the exponential growth of online shopping in recent
years, the demand for robust and feature-rich e-commerce platforms has
surged.
This project aims to address the needs of businesses and consumers in the
digital marketplace by creating a comprehensive e-commerce solution. By
leveraging modern web technologies and best practices in software
development, the project seeks to deliver an intuitive, secure, and scalable
platform for conducting online transactions.
Evolution of E-commerce
The evolution of e-commerce can be traced back to the 1990s when the
internet began to gain widespread adoption. Early e-commerce pioneers such
as Amazon and eBay paved the way for the digital marketplace, demonstrating
the potential of online retail. Over the years, advancements in technology,
security, and user experience have fueled the rapid growth of e-commerce,
leading to the emergence of diverse business models and innovative solutions.
MongoDB
MongoDB is a leading NoSQL database that stores data in flexible, JSON-like
documents. Its schema-less nature allows for easy scalability and adaptability
to evolving data models. MongoDB's support for high availability and horizontal
scaling makes it well-suited for handling large volumes of data in e-commerce
applications.
Express.js
Express.js is a lightweight and flexible web application framework for Node.js.
It provides a minimalist set of features for building web servers and APIs,
allowing developers to quickly create robust backend systems. Express.js
simplifies routing, middleware management, and request handling, making it
an ideal choice for building RESTful APIs in e-commerce applications.
React.js
React.js is a powerful JavaScript library for building user interfaces. Its
component-based architecture and virtual DOM make it efficient for creating
dynamic and interactive frontend experiences. React's declarative syntax and
reusable components streamline the development process, enabling
developers to build complex UIs with ease. In e-commerce applications,
React.js is commonly used to create product catalogs, shopping carts, and
checkout flows.
Node.js
Node.js is a runtime environment that allows developers to run JavaScript code
on the server-side. Its event-driven, non-blocking I/O model makes it highly
scalable and well-suited for building real-time applications. In e-commerce
development, Node.js powers the backend logic, handling tasks such as user
authentication, product management, and order processing. Its integration
with Express.js simplifies the development of RESTful APIs and ensures
seamless communication between the frontend and backend layers.
Lessons Learned
Through the development of the "XYZ E-commerce Platform," several lessons
were learned regarding the use of the MERN stack in e-commerce
development:
- Importance of proper data modeling and schema design in MongoDB to
optimize query performance and ensure data integrity.
- Effective use of React.js components to create a responsive and visually
appealing user interface that enhances the shopping experience.
- Implementation of authentication and authorization mechanisms in Node.js
to secure sensitive operations and protect user data.
- Adoption of best practices in API design and documentation to facilitate
collaboration between frontend and backend developers.
System Design
Architecture Overview
The system architecture of the MERN stack-based e-commerce web application
is designed to be scalable, modular, and maintainable. It follows a
microservices architecture, with separate components for frontend, backend,
and database layers. The architecture can be visualized as follows:
Frontend Layer
The frontend layer is responsible for presenting the user interface and
interacting with the user. It is built using React.js and includes components for
product browsing, shopping cart management, and checkout process. The
frontend communicates with the backend layer via RESTful APIs to retrieve
data and perform actions such as adding products to the cart or placing orders.
Backend Layer
The backend layer serves as the core of the application, handling business logic,
data processing, and communication with external services. It is implemented
using Node.js and Express.js, with routes defined for handling various API
requests. The backend layer interacts with the database layer to retrieve and
manipulate data, as well as with third-party services for tasks such as payment
processing and email notifications.
Database Layer
The database layer stores and manages the application's data, including user
information, product catalogs, orders, and transactions. MongoDB is used as
the database technology due to its flexibility, scalability, and compatibility with
JavaScript-based applications. The database is organized into collections
corresponding to different data entities, with documents structured in a JSON-
like format.
Database Design
The database schema is designed to accommodate the various data entities
and relationships within the e-commerce application. The following collections
are defined:
- Users: Stores user information such as username, email, password hash, and
role (customer or admin).
- Products: Contains details about the products available for sale, including
name, description, price, inventory count, and category.
- Orders: Tracks orders placed by users, including order ID, customer
information, product details, total amount, and order status.
- Sessions: Stores session information for authenticated users, allowing them to
persist their login state across multiple requests.
Frontend Design
The frontend design focuses on delivering a seamless and intuitive user
experience, with an emphasis on responsiveness, accessibility, and visual
appeal. The user interface is divided into multiple components, each serving a
specific purpose and interacting with the backend through RESTful API calls.
Key frontend components include:
Backend Design
The backend design focuses on implementing robust APIs, middleware, and
services to handle various business operations and ensure data consistency and
security. Key backend components include:
Integration of Components
The frontend, backend, and database components are integrated using RESTful
APIs, which define standardized endpoints and data formats for
communication between the layers. The frontend makes HTTP requests to the
backend APIs to retrieve and update data, while the backend interacts with the
database to store and retrieve information as needed. This decoupled
architecture allows for flexibility, scalability, and maintainability, as each
component can be developed, deployed, and scaled independently.
Implementation
Frontend Development
The frontend development of the e-commerce web application unfolds as a
meticulous tapestry of technological ingenuity, weaving together the fabric of
user interface excellence through the adept utilization of React.js. In this realm,
every pixel is meticulously crafted, every interaction carefully choreographed to
deliver an unparalleled user experience.
Component Architecture
At the heart of the frontend lies its architectural blueprint, meticulously
designed to foster modularity, reusability, and scalability. The application is
partitioned into an array of modular components, each entrusted with a
specific responsibility in rendering the user interface. From the ProductList
component, showcasing an enticing array of merchandise, to the
CheckoutForm component, guiding users through the seamless checkout
process, every constituent element is meticulously orchestrated to harmonize
with the broader user journey.
State Management
In the realm of dynamic user interfaces, state reigns supreme. Leveraging the
robust capabilities of React's useState and useEffect hooks, the frontend
empowers components to wield sovereignty over their state, dynamically
responding to user interactions with finesse and agility. Whether it's updating
the quantity of items in the shopping cart or toggling between different
product variants, the frontend gracefully navigates the ebb and flow of user
input, ensuring a fluid and intuitive user experience.
Routing
Navigation lies at the crux of user engagement, and React Router emerges as
the beacon guiding users through the labyrinthine corridors of the e-commerce
application. With client-side routing seamlessly integrated into the fabric of the
frontend, users traverse the application landscape with unparalleled fluidity,
transitioning between product pages, shopping cart views, and checkout
screens without the jarring interruptions of full-page reloads. It's a symphony
of seamless transitions, orchestrated to perfection for a truly immersive
browsing experience.
Aesthetic Appeal
In the realm of visual aesthetics, every pixel matters. CSS modules or styled-
components emerge as the artisans shaping the visual identity of the
application, ensuring a harmonious and visually appealing user interface across
every screen size and device type. From vibrant color palettes that captivate
the eye to responsive layouts that adapt seamlessly to the user's viewport, the
frontend is a testament to the marriage of form and function, where beauty
meets usability in perfect harmony.
Backend Development
Behind the veil of the frontend lies the robust infrastructure of the backend,
meticulously crafted using the formidable tools of Node.js and Express.js. Here,
in the realm of servers and APIs, data flows seamlessly, transactions are
processed with precision, and security stands as an unwavering sentinel
guarding the sanctity of user information.
Route Articulation
Express.js emerges as the backbone of the backend, articulating a myriad of
RESTful API routes with finesse and precision. From fetching product data to
processing orders and managing user authentication, each route is
meticulously defined, providing clients with a gateway to interact with the
underlying data and functionality of the application. It's a symphony of
endpoints, orchestrated to deliver a seamless and intuitive experience for both
users and developers alike.
Middleware Marvels
In the realm of backend architecture, middleware reigns supreme, serving as
the gatekeepers safeguarding the integrity of the application. Custom
middleware functions are meticulously crafted to perform a myriad of tasks,
from authentication and request validation to error handling and logging. It's a
delicate dance of interceptors and handlers, ensuring that every request is
scrutinized, validated, and processed with the utmost care and precision.
Database Integration
At the heart of the backend lies the beating pulse of the database, seamlessly
integrated with MongoDB, the stalwart NoSQL database renowned for its
flexibility and scalability. Here, data finds its sanctuary, nestled within the
confines of collections and documents, awaiting retrieval and manipulation at
the behest of the application. With Mongoose as its faithful companion, the
backend seamlessly interacts with the database, performing CRUD operations
with ease and efficiency. It's a symbiotic relationship, where data flows freely,
unencumbered by the constraints of traditional relational databases.
Authentication Paradigm
In the realm of user security, JWT emerges as the guardian of the gates,
fortifying user authentication with its robust encryption and token-based
authentication mechanism. Upon successful login, users are bestowed with a
JWT token, serving as their badge of authenticity as they traverse the
application landscape. With each subsequent request, the token is seamlessly
embedded, granting access to protected routes and resources with the flick of
a wrist. It's a fortress of security, where every user is authenticated and every
interaction is safeguarded against unauthorized access.
Database Implementation
The foundation of the e-commerce application's data infrastructure lies within
the hallowed halls of MongoDB, a NoSQL database revered for its flexibility and
scalability. Here, data finds its sanctuary, nestled within collections and
documents, awaiting retrieval and manipulation at the behest of the
application.
Schema Ingenuity
At the heart of the database lies its schema, meticulously designed to
accommodate the diverse array of data entities that populate the application
landscape. From user profiles and product catalogs to order histories and
session data, each schema is crafted with precision, optimized for performance
and scalability. Indexing and denormalization techniques are employed
judiciously, ensuring that queries execute with speed and efficiency, even as
the dataset grows in size and complexity.
Collection Chronicles
Within the confines of MongoDB collections, data finds its home, structured in
a JSON-like format that mirrors the hierarchical nature of the application's data
model. User credentials, product details, order histories—all find their place
within the collections, meticulously organized and indexed for efficient retrieval
and manipulation. It's a repository of data, a treasure trove of information that
powers the inner workings of the application, from user authentication to
product recommendations and beyond.
CRUD Chronicles
With Mongoose as its faithful companion, the application seamlessly interacts
with the MongoDB database, performing CRUD operations with finesse and
precision. Models and schemas are defined with care, providing a structured
interface for interacting with the underlying collections and documents.
Whether it's creating a new user profile, updating product inventory, or
deleting obsolete data, CRUD operations are executed with efficiency, ensuring
that the database remains in sync with the evolving needs of the application.
Testing Approach
A robust testing approach is paramount to ensuring the reliability,
performance, and security of the e-commerce application. From unit tests that
scrutinize individual components to end-to-end tests that validate the entire
application workflow, testing serves as the vanguard, safeguarding against
bugs, vulnerabilities, and performance bottlenecks.
Unitary Vigilance
Unit tests stand as the first line of defense, meticulously scrutinizing individual
components and functions in isolation. Using tools like Jest and React Testing
Library for frontend components, and Mocha and Chai for backend routes and
middleware, unit tests validate the behavior and functionality of each
constituent element, ensuring that it performs as expected under a variety of
scenarios and edge cases.
Integration Incursions
Integration tests take a broader perspective, validating the interaction and data
flow between frontend and backend components. By simulating user
interactions and API requests, integration tests ensure that the various layers of
the application work together harmoniously, seamlessly exchanging data and
communicating with one another as intended.
End-to-End Expeditions
End-to-end tests provide the ultimate validation of the application's workflow,
simulating real-world user scenarios to ensure that every aspect of the user
journey—from authentication and product browsing to shopping cart
management and order processing—functions flawlessly. By automating user
interactions and observing the application's behavior in a production-like
environment, end-to-end tests provide a comprehensive assessment of the
application's reliability, performance, and security.
function App() {
const { user, isAuthenticated } = useSelector((state) => state.user);
const [stripeApiKey , setStripeApiKey] = useState("")
return (
<Router>
<Header />
{isAuthenticated && <UserOptions user={user} />}
<Routes>
<Route exact path="/" element={<Home />} />
<Route exact path="/product/:id" element={<ProductDetails />} />
<Route exact path="/products" element={<Products />} />
<Route path="/products/:keyword" element={<Products />} />
<Route exact path="/search" element={<Search />} />
{isAuthenticated && (
<Route exact path="/account" element={<Profile />} />
)}
{isAuthenticated && (
<Route exact path="/me/update" element={<UpdateProfile />} />
)}
{isAuthenticated && (
<Route exact path="/password/update" element={<UpdatePassword
/>} />
)}
{
isAuthenticated && (
<Route exact path="/shipping" element={<Shipping />}/>
)
}
{
isAuthenticated && (
<Route exact path="/order/confirm" element={<ConfirmOrder/>} />
)
}
{
isAuthenticated && (
<Route exact path="/process/payment" element={<Payment/>}/>
)
}
1. User Registration: Embarking on the journey, users are welcomed with open
arms to create their accounts, providing essential details such as email
addresses, usernames, and passwords. To safeguard user privacy, passwords
undergo secure hashing before storage, ensuring utmost confidentiality and
integrity of user credentials.
2. User Login: Returning users are greeted with the familiar embrace of the
login screen, where they provide their credentials—email addresses and
passwords. Upon successful authentication, a JSON Web Token (JWT) is
dynamically generated, serving as the hallmark of authenticated access and
granting users entry to protected resources.
Product Catalog
The product catalog emerges as the vibrant marketplace within the e-
commerce domain, beckoning users with a cornucopia of merchandise
spanning diverse categories and niches. With an array of features designed to
elevate the browsing experience, the product catalog unfolds as a testament to
user engagement and discovery:
1. Product Listings: A veritable tapestry of products adorns the digital
landscape, elegantly showcased in a grid layout adorned with captivating
thumbnail images, enticing titles, prices, and succinct descriptions. To
accommodate expansive catalogs, pagination or infinite scrolling seamlessly
guides users through the treasure trove of offerings.
3. Product Details: Delving deeper into the realm of discovery, users embark on
immersive journeys through product details pages, where comprehensive
information unfurls. From striking images and rich descriptions to detailed
specifications, customer reviews, and tantalizing glimpses of related products,
users are equipped with the insights needed to make informed purchasing
decisions.
Shopping Cart
The shopping cart emerges as the digital repository for users' coveted
treasures, facilitating the seamless aggregation, review, and management of
selected items. With an array of features designed to augment the user's
journey, the shopping cart embodies convenience and flexibility:
4. Clearing Cart: With a single stroke, users embark on a clean slate, effortlessly
clearing their carts and resetting them to their pristine state. This feature
ensures flexibility and convenience, allowing users to recalibrate their shopping
journeys with ease and efficiency.
Checkout Process
The checkout process serves as the gateway to fulfillment, guiding users
through the final steps of order placement with precision and efficiency. A
symphony of features orchestrates the user's journey through the checkout
process, ensuring a seamless transition from browsing to ownership:
4. Order Confirmation: With a decisive click, users seal the deal, finalizing their
orders with confidence. A succinct confirmation message heralds the successful
completion of the transaction, with order confirmation emails dispatched to
users' registered email addresses for reference and peace of mind.
Order Management
Order management stands as the backbone of operational efficiency,
empowering store owners with the tools to track, manage, and fulfill orders
with precision. A wealth of features underscores the order management
process, ensuring seamless orchestration of the fulfillment journey:
2. Order Processing: Armed with insights, store owners navigate the intricacies
of order fulfillment with confidence. Detailed order information empowers
timely actions such as marking orders as shipped, updating tracking
information, and generating invoices to streamline the fulfillment process.
Wireframing
Wireframing emerges as the foundational cornerstone of the UX design
process, offering a blueprint for the application's structure, layout, and flow.
With meticulous attention to detail, wireframes serve as the architectural
scaffolding upon which the application's design narrative unfolds:
3. User Flows: Prototypes articulate the user's journey through the application,
elucidating common workflows and scenarios. By simulating task completion,
from browsing products to completing a purchase, prototypes offer
stakeholders a holistic view of the user experience, fostering empathy and
alignment with user needs and expectations.
User Testing
User testing emerges as the crucible of user-centric design, offering designers
invaluable insights into usability, functionality, and user satisfaction. Through
rigorous testing and analysis, the application's design narrative is refined and
optimized to resonate with users' needs and preferences:
1. Test Planning: Each testing session is meticulously orchestrated, with a
comprehensive test plan outlining objectives, methodology, participant criteria,
and success criteria. Test scenarios and scripts guide participants through tasks,
ensuring consistency and rigor in the testing process.
5. Iterative Design: Findings from user testing sessions serve as compass points
guiding iterative design improvements, with changes implemented to address
identified issues and enhance the overall user experience. Through iterative
refinement, the application's design narrative evolves in lockstep with user
needs and expectations, ensuring alignment and resonance with its intended
audience.
Security Considerations
Data Encryption
Protecting the confidentiality and integrity of sensitive data is paramount in the
e-commerce web application's security framework. Robust encryption
techniques are meticulously implemented to safeguard sensitive information
both in transit and at rest:
1. Code Reviews: Peer code reviews serve as the crucible of scrutiny, subjecting
codebases to meticulous examination for security flaws, coding errors, and
vulnerabilities. Through collaborative scrutiny, the application's codebase
emerges fortified against the insidious incursions of exploitation and
compromise.
Caching
Database Optimization
Content Optimization
2. Lazy Loading: A paragon of deference, lazy loading defers the loading of non-
essential resources until they are summoned forth by the user's gaze. Images
and ancillary resources stand poised in the wings, awaiting the clarion call of
user interaction before venturing forth, thereby minimizing initial page load
times and conserving precious bandwidth.
Performance Monitoring
Vigilant sentinels stand poised at the ramparts of performance, surveilling the
application's performance landscape with unwavering vigilance:
3. Real User Monitoring (RUM): In the crucible of real user monitoring lies the
key to understanding user behavior and experience in the wild. Real user
monitoring tools, perched within the bowels of user devices and browsers,
bear witness to the ebb and flow of user interactions and page load times,
furnishing stakeholders with invaluable insights into user experience and
performance metrics across diverse platforms and locales.
Cloud Infrastructure
The e-commerce web application finds its abode within the hallowed halls of
cloud infrastructure platforms, where the ethereal mists of scalability and
reliability converge to orchestrate a symphony of digital commerce. Embracing
platforms such as Amazon Web Services (AWS), Microsoft Azure, or Google
Cloud Platform (GCP), the application basks in the myriad benefits bestowed by
cloud infrastructure:
1. Scalability: Enveloped within the cloud's nimbus, the application avails itself
of auto-scaling capabilities, dynamically adjusting resources in response to the
ebb and flow of traffic. As the tides of user engagement surge, cloud providers
deftly summon forth additional server instances, ensuring optimal performance
and availability during peak traffic epochs.
Containerization
Amidst the labyrinthine corridors of deployment, containerization emerges as a
paragon of portability and consistency, bestowing upon the application the
ability to traverse the digital landscape with unparalleled agility and uniformity.
Through the vessel of containerization technologies such as Docker, the
application embarks upon a voyage of encapsulation, packaging its
dependencies into portable, lightweight containers endowed with the
following virtues:
3. Alerting: Across the expanse of vigilance, the clarion call of alerting beckons,
urging stakeholders forth on a journey of proactive intervention. Configured
within the crucible of monitoring tools, alerts stand poised to notify DevOps
teams of critical issues, performance anomalies, or service disruptions,
affording them the luxury of swift and decisive action amidst the tempestuous
seas of operational uncertainty.
1. Data Encryption: Within the crucible of data transmission and storage, the e-
commerce web application enshrouds sensitive user data—credentials,
payment information, and personal details—in the impenetrable cloak of
encryption. Through the alchemy of encryption protocols such as SSL/TLS, the
application erects a fortress of digital fortitude, warding off the specter of
unauthorized access and disclosure.
2. User Consent: Across the expanse of data collection and processing, the
clarion call of user consent reverberates with unerring clarity. Through the
conduits of clear and transparent privacy policies and consent mechanisms, the
application seeks the imprimatur of user consent before embarking upon the
odyssey of data collection, ensuring transparency and accountability in its
dealings with user data.
4. Data Retention: Across the annals of data governance, the specter of data
retention looms large, casting its shadow over the digital landscape. Within the
crucible of data retention policies, the application delineates the contours of
data lifespan, defining the duration for which personal data is retained and the
purposes for which it is used. Data that outlives its utility is consigned to the
annals of oblivion, securely deleted or anonymized to ensure compliance with
regulatory mandates.
5. Data Access Controls: Amidst the hallowed halls of data guardianship, the
crucible of access controls stands as a sentinel of vigilance. Access to sensitive
data is circumscribed by the impenetrable ramparts of role-based access
controls and permissions, ensuring that only authorized personnel with
requisite credentials may traverse the hallowed corridors of sensitive data.
Audit trails stand as silent sentinels, bearing silent witness to the ebb and flow
of access, tracking every ingress and egress with unwavering precision.
Accessibility Compliance
3. Color Contrast: Across the spectrum of visual design, the specter of color
contrast stands as a sentinel of inclusivity. Text and interactive elements—
enshrouded within the crucible of color contrast guidelines—adhere to the
precepts of readability and distinguishability, ensuring legibility for users with
visual impairments. Through the prism of color contrast, the application fosters
an environment of inclusivity, where users of all abilities may traverse the
digital landscape with equanimity and grace.
Legal Compliance
2. Privacy Policy: Within the hallowed halls of data governance, the crucible of
privacy policies stands as a testament to transparency and accountability.
Transparent privacy policies—imbued with clarity and conciseness—inform
users about the collection, use, and sharing of their personal data, affording
them the luxury of informed consent and autonomy over their digital footprint.
4. Consumer Protection: Within the crucible of consumer rights, the clarion call
of fairness and transparency reverberates with unerring clarity. Compliance
with consumer protection laws—enshrined within the bastions of legal
compliance—ensures fair and transparent business practices, accurate product
descriptions, pricing transparency, and clear refund and return policies.
Through the crucible of consumer protection, the application fosters an
environment of trust and confidence, where consumers may traverse the
digital marketplace with equanimity and assurance.
Regulatory Compliance
Future Enhancements
While the e-commerce web application has achieved significant milestones, the
journey towards innovation and improvement is ongoing. Looking ahead, there
are several areas where future enhancements can further elevate the user
experience, expand functionality, and embrace emerging technologies:
The journey of building the e-commerce web application is not just about
creating a product—it's about creating an experience, forging connections, and
empowering businesses to thrive in the digital age. As the application charts its
course into the future, the possibilities are limitless, and the adventure is just
beginning.
function App() {
const { user, isAuthenticated } = useSelector((state) => state.user);
const [stripeApiKey , setStripeApiKey] = useState("")
useEffect(() => {
WebFont.load({
google: {
families: ["Roboto", "Droid Sans", "Chilanka"],
},
});
store.dispatch(loadUser());
getStripeApiKey();
}, []);
return (
<Router>
<Header />
{isAuthenticated && <UserOptions user={user} />}
<Routes>
<Route exact path="/" element={<Home />} />
<Route exact path="/product/:id" element={<ProductDetails />} />
<Route exact path="/products" element={<Products />} />
<Route path="/products/:keyword" element={<Products />} />
<Route exact path="/search" element={<Search />} />
{isAuthenticated && (
<Route exact path="/account" element={<Profile />} />
)}
{isAuthenticated && (
<Route exact path="/me/update" element={<UpdateProfile />} />
)}
{isAuthenticated && (
<Route exact path="/password/update" element={<UpdatePassword
/>} />
)}
{
isAuthenticated && (
<Route exact path="/shipping" element={<Shipping />}/>
)
}
{
isAuthenticated && (
<Route exact path="/order/confirm" element={<ConfirmOrder/>} />
)
}
{
isAuthenticated && (
<Route exact path="/process/payment" element={<Payment/>}/>
)
}