Report Content
Report Content
Introduction 1
1 E-commerce 2
1.1 Definition 2
1.2 Categories 2
1.3 Advantages 2
1.4 Disadvantages 4
2 ReactJS 4
3 Firebase 8
3.1 Overview 8
3.2 Firebase Outstanding services 9
3.2.1 Firebase Authentication 10
3.2.2 Firebase Realtime Database 11
3.2.3 Firebase Cloud Storage 12
3.2.4 Firebase Hosting 14
3.2.5 Performance Monitoring 16
5 Conclusion 32
References 32
List of Abbreviations
UI: User Interface is everything a user interacts with when using a digital
product or service.
1
Introduction
Modern technology has improved the quality of human life in many aspects.
Internet has become a crucial aspect of our daily lives, especially in this current
pandemic status and crisis. By the early 2022, there were an estimated
5.25 billion active internet users worldwide, or 66.2 percent of the global
population, according to (www.broadbandsearch.net). Throughout history, the
convenience of ordering food or other goods online has grown in importance.
Online shopping can be done via a website or a mobile app.
In 2020, 56.8% of all internet traffic was generated by mobile devices. However,
a mobile landing page takes an average of 25 seconds to load. You can't argue
with the fact that 55 percent of people will close the website if the loading time is
more than 3 seconds. A large amount of web users has shifted to use native
applications for their day-to-day activities on the internet. e-commerce has seen
a 62 percent growth in this sector in 2019. As a result, web users are spending
less time on their browsers, and web developers are scrambling to keep up with
native apps in terms of user experience.
E-commerce web applications for businesses, especially small ones, are the
focus of the thesis. The outcome is to build the prototype of an e-commerce web
application. It's possible to create dynamic websites with JavaScript, which
responds to user requests and improves the user experience. React, a free-to-
use JavaScript library is utilized to construct a friendly and efficient user interface.
1 E-commerce
1.1 Definition
1.2 Categories
1.3 Advantages
homes, without the need to visit actual stores. It saves enormous amounts of time
and expedites transactions.
Minimizing the cost: Businesses do not need to create physical stores during
conducting E-commerce model. There are substantial costs associated with
operating a store, including rent, utilities, other bills, and employee compensation.
It eliminates the physical costs and conducts all commercial operations via an
internet platform.
24/7 Availability: The option to shop online is available all the time, 24 hours a
day, 7 days a week. One of the best things about e-commerce is that customers
can buy things online at any time. Unlike traditional stores, this site doesn't have
set times for when it opens and when it closes.
1.4 Disadvantages
In the case of online purchasing, customers lack the ability to touch and feel.
Customers are sometimes happier with in-person purchases since they may
inspect the product before to purchase.
Security Concerns: During online purchasing online, customers have the risk of
being stolen crucial credentials. Hackers may steal client information and lead to
serious financial lost.
Customers are not able to test out a product before making a purchase when they
shop online. This is a disadvantage. They cannot negotiate prices and acquire
additional information about the product's usage and qualities, as they would in a
real store with a salesperson.
2 ReactJS
With React, developers can make large web apps that can change data without
having to reload the page. React's main goal is to be fast, easy to use, and
scalable. It only works on the user interfaces of the app. The view in the MVC
template is the same as this. It can work with other libraries or frameworks written
in JavaScript, like Angular JS in MVC. React is the shorter form of ReactJS.
These are the features that make the React library so good and strong for building
modern apps, as well as what distinguishes React from competing frameworks
and libraries:
6
Consider the following scenario: you have an application, and you want to
update just the areas of your DOM tree that are affected by state changes. You
don't want to re-render your whole UI from start because it would be expensive
in terms of performance and user experience. React employs a feature known
as virtual DOM, which is a virtual version of the real DOM tree. It's simply a tree
data structure of basic JavaScript objects that is maintained in memory
synchronized as depicted in figure 1. Because the virtual DOM will never be
presented to the user, it will only exist in memory, rendering it is quicker.
React builds a duplicate of your real DOM tree when your React app loads.
Instead of re-rendering the whole real DOM tree whenever a state change occurs
in your application, React first updates its virtual DOM with the changed state.
React then compares its virtual DOM to your actual DOM tree to determine what
needs to be modified. Then it modifies your actual DOM tree, but it just changes
7
the components that need to be altered. The virtual DOM is one of the aspects
that contribute to the React framework's speed and dependability.
2.2.2 JSX
2.2.3 Components
React components are responsible for the reusability of our code and the
segmentation of our UI into distinct parts. React components operate in the same
method as JavaScript functions. A React component takes arbitrary inputs, called
props, and must always return a React element indicating what should be
presented to the user. Defining a JavaScript function that returns a React element
is the simplest approach to construct a React component.
In the figure, Welcome is a React component that receives a single prop named
props and returns a React element, in this example a basic h1 element. If a React
component fails to return a React element, it will issue an error. React
components adhere to the separation of concerns design concept, which dictates
that a computer program (in this example, our application) should be divided into
distinct pieces, with each section addressing distinct issues.
8
React components are extremely effective because they enable us to write code
that is clearer, more resilient, and more succinct throughout the whole application.
We can have an unlimited number of React components.
3 Firebase
In 2011, Firebase was born under the name Envolve by James Tamplin and
Andrew Lee. The purpose Envolve provides developers with APIs is to integrate
live chat functionality into websites. However, more than just chatting, users have
expanded the usability of Envolve. Developers have taken advantage of Envolve
to transfer application data such as online games, contacts, calendars, etc.
Therefore, the two founders of Envolve split the online messaging system and
real-time data synchronization into two separate parts. In April 2012, Firebase
was created as a separate company Backend-as-a-Service with Realtime
functionality. In 2014, Google acquired Firebase. After that, Firebase quickly
evolved into the versatile application of today's mobile and web platforms.
3.1 Overview
Firebase is a database service that operates in the cloud. Google's server system
is incredibly powerful. Its primary purpose is simplifying database operations.
In simple API, the objective is to raise the amount of users and maximize
profitability.
Additionally, the service is highly flexible and secure. Firebase supports both
Android and iOS. It is not surprising that many developers chose Firebase as
their initial platform for creating apps for millions of people globally.
Firebase is a versatile platform that provides a lot of different services to its users.
But when it comes to this platform, people still think of the following outstanding
services.
10
Firebase Authentication can be seen as an intermediary that will handle all 3rd
party logins as can be seen in figure 4.
Firebase's user interface provides access to both password recovery and user
verification. Without disclosing their true identify, customers can set up an
anonymous temporary account that is able to link to 3rd party provider later. In
addition, it features a technique known as Smart Lock for automatically
remembering and logging in with credentials. Email address is required as a sign-
in credential by the Firebase authentication SDK.
11
Firebase Realtime Database is a NoSQL data type stored in the cloud that allows
you to store and synchronize user data in real time. In practical, your data is
stored as a JSON object, which the developer can manage in real time. Realtime
Database Service
As can be seen from the illustration in figure 5 above, with only a single API, you
will get both the latest data and its updates.
Realtime syncing helps users access their data from any device. One
advantage of Realtime Database is that Firebase will provide you with an SDK
for you to easily build mobile and web applications without a server. When the
device is offline, the Realtime Database SDK uses the device's memory. The
application still interacts with the user as usual. When the device is back online,
it automatically syncs to the server.
Using a few client-side codes, it specifies who can view specific information.
Thanks to real-time database (NoSQL-based database) hosting, operating and
maintaining server is no longer compulsory. The Real-time database is
compatible with Android, iOS, Web, C++, Unity Platform, and JavaScript (Google
2019). Real-time Database supports up to one hundred thousand concurrent
connections and one thousand per second per database.
Due to the different database, the data set is modified and improved, and a real-
time database is integrated using Cocoa Pods or Gradle to improve client access
time. This approach additionally provides offline writing capabilities while
maintaining client security. These are the fundamental stages for creating a
Firebase Real-time Database: Integrate the Firebase Realtime Database SDKs,
build Realtime Database References, enable Offline Persistence, and safeguard
data (Google 2019).
The following figure illustrates how Firebase Cloud Storage is the data storage
space. If you are planning to work with Google Cloud Platform, specifically
Google Cloud Storage, then Firebase Cloud Storage is the top choice in the list
of services that you need to refer to.
13
In short, Firebase Cloud Storage is the data storage space. The data here has
no limit at all. You can contain any file(s) you want, like photos, music, videos or
text files, zip or even a file with your own data type of your own design. You might
be thinking, “Hey, how does that sound like Google Drive?” – Same, but the
purpose of Firebase Cloud Storage is for programming activities, as a foundation
for you to build software products on, not for personal purposes. In fact, it's like
the storage space on your Web host.
If you already have a Realtime Database, why to have Cloud Storage? The
answer is very simple. Realtime Database is more "as a database" than Cloud
Storage - which is a place to store separate files. From a dynamic perspective,
the Realtime Database is "dynamic", that is, when there is a change in the
database, the Firebase server will immediately send Events to the devices, while
Cloud Storage does not. From a capacity perspective, with the Spark package,
you only have 1GB for Realtime Database, while you have up to 5GB for Cloud
Storage. Cloud Storage has a set of libraries for you to simply apply to your
projects. You don't need to write any code to make APIs, to handle events when
users send requests, upload or download files at the server unless that is
necessary. And if you are planning to work with Google Cloud Platform,
specifically Google Cloud Storage, then Firebase Cloud Storage is the top choice
in the list of services that you need to refer to.
14
Firebase Hosting is an API platform that acts like a real database hosting service
on the Cloud platform - cloud computing. Integrated and used at the same time
with Google's own powerful server system. You may know that the main function
of Firebase Hosting is to help programmers simplify many database operations
when setting up the Website structure. When Firebase Hosting is integrated into
the system, you can save a lot of time and effort to design the backend for your
website. Particularly, Firebase in general and Firebase Hosting is also considered
a versatile database storage service with excellent data security capabilities. In
the world, Firebase Hosting is one of the top choices, it can be said that Trend
Hosting has many integrated Web sites for its website system. For example,
when you want to develop an instant synchronous online chat function like
messaging Facebook, the programmer only needs to develop on the user side
the remaining functions when integrated. to the Website. You just need to call the
properties of the API and you can connect and use it right away.
You can simply understand that Firebase Hosting provides hosting and data
sharing services to users through SSL security technology standards from the
CDN network development system right on the Cloud platform - cloud computing
to users. real use. With this security standard, you can simply understand how it
works through a CDN that helps Firebase Hosting to optimize data more with a
system of cloud servers located around the world. End users can easily access
with faster speed and better stability and use services on your website when
Firebase Hosting is integrated.
15
As illustrated in figure 8, Firebase Hosting usage can deploy files to our hosting
server from a local directory on our PC by using the Firebase CLI command-line
interface. In addition to delivering static material, we can host Microsoft on our
sites using cloud runs or cloud functions. The nearest edge server on the global
CDN is used to distribute all material via an SSL connection. Firebase's
lightweight hosting choices allow us to construct complex PWAs with ease.
Custom headers and URL rewriting for client-side routing are simple to
implement.
Firebase provides a variety of domain and subdomain choices for serving our
content:
• By default, free subdomains are provided for all Firebase projects on the
firebaseapp.com and web.app domains. There is no difference in the
content and configuration of the two.
16
• If we have numerous apps and sites that use the same Firebase project
resources, we can establish multiple sites (for example, if we have an
admin panel, blog, and public app).
• A Firebase-hosted site can be linked to our own domain name.
Firebase automatically configures SSL certificates for all our domains, ensuring
that all our content is presented in a secure manner.
The project is a full stack e-commerce application using React, Redux and
Firebase.
This chapter explains the fundamental steps of developing process, and the
outcome of the project – a high-performance e-commerce webstore consists of
five primary pages:
The Authentication page is the initial page of the whole website system, it requires
the user to provide the login credentials, email and password as authenticators.
Additionally, if the credentials are not yet registered to the system yet, users are
needed to sign up for their information. Authentication is a must in order to access
the entire site.
The Homepage is the next destination after the authentication was conducted.
Homepage allows users to perform multiple tasks such as seeing thumbnail
pictures of the products, adding a product to the shopping cart or seeing the
product details in subpages. In Homepage, the users can also navigate to other
pages like Cart and Orders, or even logging out the shopping system.
18
The Cart page will display all the selected products by the user and provide the
total cost of those items. Customer could also delete unwanted items from the
cart. After checking the cart, placing the order is the ultimate destination of the
whole shopping process, you need to provide your address in order to place the
order.
The last page would be the Admin Panel page, it can only be accessed by the
administrators. With this panel, the admin users have the right to add new
product, edit product’s details or even delete a product. Beside managing the
products, the panel also shows all orders placed of all the system in Order tab.
Before developing the program, the environment must be established. The first
tool is NodeJS version 13.12.0. NodeJS could be used on both the client and
server. We choose Visual Studio Code is one as our "source-code editor" due to
its graphical user interface and snippets that make writing easier and more
convenient, such as ES7 React/Redux. In the other hand, Firebase CLI 10.5.0
helps viewing, managing and deploying the project with several tools. Finally,
developer can establish the connection between Firebase Cloud and the local.
There are four main parts in the project structure, which can be shown in the
Figure 10.
• HTML: index.html.
• CSS: index.css and App.css.
• JavaScript: App.js, other components and redux.
• Firebase: fireConfig.js.
4.4.1 Index.html
Figure 11 represents the HTML file's core component. “.js files” include definitions
for all the major functions. The external CSS sources used in this project are
stored in this file. "root" is the id for the web app.
Figure 14 shows that the application consists of various parts such as Homepage,
Authentication including Login and Register pages, Product Info, Cart, Orders
and Admin page.
React-router-dom helps navigating more accurate and faster.
23
4.4.4 Redux
The working way of Redux is very simple. There is a central "store" that holds the
entire state of the application. Each component can access the stored state
without having to send it from one component to another. There are three things
need to be constructed: actions, store, and reducers.
In this project, Redux is mainly used to manage the loading, adding and deleting
state of the products in store and cart. Here are some illustrations of the way
Redux was used in the project.
The following figures illustrate the outcome of the project – a webstore prototype
with simple user interface.
Installing the Firebase Hosting will enable developers to deploy the application,
and then sign into Firebase from your terminal to get started. If this is the first time
developing, you will be required to provide email and password before
proceeding. Additionally, you must check the root directory whether if your React
application has already been configured for using Firebase.
4.8 Testing
It's also essential to test the application to ensure that it works and is compatible
with the great majority of browsers. Refer to being bug-free, the online material
is also examined for grammatical mistakes.
Every item was examined, items were seen with pictures, the products were
filtered according to their name and category. Preferred items were added to and
removed from the cart as necessary. The system operates perfectly in every way.
There were no issues with the examination.
31
The test was done on a variety of platforms, including Android, iOS, and
Windows. All the tested mobile devices could connect to the webstore without
any issues, indicating a positive outcome. It seems that all images, buttons, and
other design elements are shown correctly on the screen.
Because of the lack of time, real payment and invoicing could not be implemented
in this project. But it is recommended to add these features in future development.
Subscribing to the newsletter for promotion and discount is also a promising
developing option. When it comes to E-commerce, website visibility and online
marketing play a crucial role in the success of the business. One of the good
ways to boost the marketing is to optimize the search engine. Additionally, we
can consider making the webstore available in different languages than English
to target more customer sectors.
32
5 Conclusion
In this webstore, users could perform various actions such as viewing the
collections of items with thumbnails, adding and editing the product items, putting
items to shopping cart and placing order.
For frontend technology, following by HTML/CSS, React has help to build a basic
but useful user interface. Redux was used in state managements. Firebase
services plays a vital role in building a serverless backend
Deploying and testing was conducted in different platforms. The outcome was
positive because the webstore satisfies all the listed requirements.
In short, the web application prototype can fulfil all basic needs of an e-commerce
webstore with a low cost. Therefore, it can help small companies a sustainable
way to expand their businesses.
References
Figures