1. Trang chủ
  2. » Luận Văn - Báo Cáo

Mid term project firebase firestore report

97 0 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Firebase Firestore Report
Tác giả Nguyễn Trần Đại Hòa, Huỳnh Nhật Hào
Người hướng dẫn Dr. VŨ ĐÌNH HỒNG
Trường học Ton Duc Thang University
Chuyên ngành Mobile Application Development
Thể loại Mid-term Project
Năm xuất bản 2023
Thành phố Ho Chi Minh City
Định dạng
Số trang 97
Dung lượng 13,85 MB

Nội dung

This implies that users cannotrun Firebase applications on cloud service providers other than Google Cloud.- Limited customization capabilities: Firebase stores its database in JSON form

Trang 1

MID-TERM PROJECT

FIREBASE FIRESTORE REPORT

Instructor : Dr VŨ ĐÌNH HỒNG Executor : NGUYỄN TRẦN ĐẠI HÒA – 521H0058

HUỲNH NHẬT HÀO – 520H0531

HO CHI MINH CITY, 2023

Trang 2

MID-TERM PROJECT

FIREBASE FIRESTORE REPORT

Instructor : Dr VŨ ĐÌNH HỒNG Executor : NGUYỄN TRẦN ĐẠI HÒA – 521H0058

HUỲNH NHẬT HÀO – 520H0531

HO CHI MINH CITY, 2023

Trang 3

THANK YOU

First and foremost, we would like to express our deep gratitude to Dr Vu Dinh Hong for his dedicated guidance and support in helping us complete this report We also extend our thanks to Ton Duc Thang University for its invaluable assistance throughout the Mobile Application Development course The report may contain errors, and we hope for understanding and forgiveness from Dr Hong and the university.

Trang 4

PROJECT COMPLETED

AT TON DUC THONG UNIVERSITY

I hereby declare that this is our own project and is under the guidance of Dr.

Vũ Đình Hồng The research contents and results in this topic are honest and have

not been published in any form before The data in the tables for analysis, comments and evaluation are collected by the author himself from different sources, clearly stated in the reference section.

In addition, the project also uses a number of comments, assessments as well as data from other authors, other agencies and organizations, with citations and source annotations.

If I find any fraud, I will take full responsibility for the content of my project.

Ton Duc Thang University is not related to copyright and copyright violations caused

by me during the implementation process (if any).

City Ho Chi Minh, May Day

Author (sign and write full name)

Nguyễn Trần Đại Hòa

Huỳnh Nhật Hào

Trang 5

TEACHER'S CONFIRMATION AND

ASSESSMENT SECTION

The confirmation part of the instructor

_ _ _ _ _ _ _

City Ho Chi Minh, November 27th, 2023

The evaluation part of the teacher marks the test

_ _ _ _ _ _ _

City Ho Chi Minh, November 27th, 2023

TABLE OF CONTENTS

Trang 6

THANK YOU i

PROJECT COMPLETED ii

AT TON DUC THONG UNIVERSITY ii

TEACHER'S CONFIRMATION AND ASSESSMENT SECTION iii

TABLE OF CONTENTS iv

TABLE OF PICTURE vii

SUMMARY x

CHAPTER I – INTRODUCTION 1

1.1 Subsection level 1 1

1.2 Introducing the report 1

CHAPTER II – FIREBASE 3

2.1 What is Firebase ? 3

2.2 History of Firebase 4

2.3 Pros and Cons: 5

2.3.1 Pros: 5

2.3.2 Cons: 7

2.4 Realtime Database and Cloud Firestore: 9

2.4.1 What is Firebase Realtime Database: 9

2.4.2 Main function of FRD: 10

2.4.3 How Firebase Realtime Database works ? 11

2.4.4 What is Cloud Firestore ? 12

2.4.5 Main functions of Cloud Firestore: 12

2.4.6 How Cloud Firestore works ? 14

2.4.7 Difference between Realtime Database and Cloud Firestore 15

2.5 Authentication: 19

2.6 Analytics: 20

2.7 Test Lab: 21

Trang 7

2.8 Cloud Messaging (FCM): 22

2.9 Hosting: 22

2.10 Remote Config: 24

CHAPTER III – DESIGN ANALYSIS 25

3.1: Requirement 25

3.1.1: Objective 25

3.1.2: Key Software Functions: 25

3.2 User Account Management 26

3.2.1 User Login: 26

3.2.2: Change profile User/Management account: 31

3.2.3 View List of System Users 36

3.2.4 Add a New User/Manager 38

3.2.5 Delete a User/Manager 41

3.2.6 Modify User/Manager Information 44

3.2.7 View Login History of a User 47

3.3 Student Management 49

3.3.1 View List of Students 49

3.3.2 Add a New Student 50

3.3.3 Delete a Student 53

3.3.4 Update Student Information 55

3.3.5 Sort the List of Students based on various criteria 59

3.3.6 Search for Students using multiple criteria 62

3.3.7 Access Student Details Page 64

3.4 Data Import/Export 76

3.4.1 Import a list of student from a file 77

3.4.2 Export the list of students to Excel/CSV 78

3.4.3 Import a list of certificates for a student from a file 79

Trang 8

3.4.4 Export the list of certificates to Excel/CSV 80

3.5 Using Firebase 80

3.5.1 Firestore 80

3.5.2 Realtime Database 81

3.5.3 Storage 81

CHAPTER IV – CONCLUDE 82

4.1 Achieved result 82

4.2 Limitations and improve 83

TABLE OF PICTURE

Trang 9

Picture 2 1: Firebase 2

Picture 2 2: History 3

Picture 2 3: Pros and Cons 4

Picture 2 4: Pros and Cons 2.0 6

Picture 2 5 Security 7

Picture 2 6: Firebase Realtime Database 8

Picture 2 7 Realtime Database functions 9

Picture 2 8 : Realtime Database works 10

Picture 2 9 : Cloud Firestore 11

Picture 2 10 : Cloud Firestore functions 12

Picture 2 11 : Cloud Firebase works 13

Picture 2 12: Difference between Realtime Database and Cloud Firestore 14

Picture 2 13: Data model: 14

Picture 2 14: Real-time data and offline support 15

Picture 2 15: Security of Cloud Firestore and Realtime Database 17

Picture 2 16: Authentication 18

Picture 2 17: Analytics 19

Picture 2 18: Test Lab 20

Picture 2 19: Cloud Mesaging 21

Picture 2 20: Hosting 22

Picture 2 21: Remote Config 23

Picture 3 1: Login 26

Picture 3 2: Login as admin account 27

Picture 3 3: Functions as admin 28

Picture 3 4 Functions as Management 29

Trang 10

Picture 3 5: Functions as User 30

Picture 3 6: Edit profile 31

Picture 3 7: Change avatar 32

Picture 3 8: Change Name 33

Picture 3 9: Change Age 34

Picture 3 10: Change Phone number 35

Picture 3 11: List of Users 36

Picture 3 12: Add new User/Manager 37

Picture 3 13: After add New User 39

Picture 3 14: After save add new user 40

Picture 3 15: Delete User 41

Picture 3 16: Delete confirm User 42

Picture 3 17: After Delete User 43

Picture 3 18: Edit User information 44

Picture 3 19: Change information 45

Picture 3 20: After Change 46

Picture 3 21: View History Login 47

Picture 3 22: View List Student 49

Picture 3 23: Add New Student 50

Picture 3 24: Student information added 51

Picture 3 25: After add new Student 52

Picture 3 26: Delete Students 53

Picture 3 27: Delete Students confirm 54

Picture 3 28: Change Students profile 55

Picture 3 29: Change Students information 56

Picture 3 30: After Change 57

Picture 3 31: View Chage Students profile 58

Trang 11

Picture 3 32: Sort list of Students 59

Picture 3 33: Sort by type 60

Picture 3 34: Result of sort function 61

Picture 3 35: Search Student by type 62

Picture 3 36: Search Students by ID 62

Picture 3 37: Result of Search function 63

Picture 3 38: View Student Details Page 64

Picture 3 39: View Student Details Page for choose view certificate 65

Picture 3 40: View List of certificates 66

Picture 3 41: Add new Certificate 67

Picture 3 42: Add certificate information 68

Picture 3 43: After Add certificate 69

Picture 3 44: Delete certificate 70

Picture 3 45: Confirm delete certificate 71

Picture 3 46: Result of Delete function 72

Picture 3 47: Update/Change information of certificate 73

Picture 3 48: Change information 74

Picture 3 49: After Change 75

Picture 3 50: Import lisr of Students 76

Picture 3 51: List of Students file 77

Picture 3 52: Export list of Students 78

Picture 3 53: List of certificate file 79

Picture 3 54: Export list of certificate 79

Picture 3 55: Firestore 80

Picture 3 56: Realtime Database 80

Picture 3 57: Storage 81

Trang 12

This report delves into what we have learned from our instructor and theuniversity, as well as from online resources about Firebase It encompasses hands-oncoding practices and detailed code descriptions Additionally, the report provides anintroduction to each section outlined in Chapter 1, offering an overview of the contentand objectives of the report

Trang 13

CHAPTER I – INTRODUCTION

1.1 Subsection level 1

Use Times New Roman (Unicode) font size 13 of Winword; normal letter density ; do not compress or stretch the space between letters; line spacing set to 1.5 lines top margin 3.5 ; cm ; bottom margin 3 cm ; left margin 3.5 cm ; right margin 2 cm .Page numbers are numbered in the middle, at the top of each page If there are tables,tables, and drawings presented horizontally, the top of the table is the left margin of thepage, but it should be limited to this way

Contents of subsection level 1, an item, when subdivided, is at least 02 items (ie, if there is 1.1.1, there must be 1.1.2)

sub-1.1.1 Subsection level 2

Detailed content of the subsection

1.1.2 Subsequent Level 2 Subsection

Not always subdivided into level 3 subsections, if the presentation isencapsulated

1.2 Introducing the report

- The report is a comprehensive exploration of the data amassed, researched, assimilated, and synthesized by the team concerning Firebase It encompasses anin-depth overview and offers detailed instructions for effectively implementing the code provided in the course

Trang 14

1.2.3 Chapter 3: Content of code

- The content about what we do in the source code, how to run it

1.2.4 Chapter 4: Conclude

Trang 16

2.2 History of Firebase

Picture 2 2: History

In 2011, James Tamplin and Andrew Lee introduced Evolve This was aplatform with a relatively simple structure designed to provide essential APIs forintegrating chat features into websites However, they soon realized that the platformwas being used not just for chat but also for transmitting application data.Subsequently, they developed Envole, ultimately leading to the creation of Firebase

By April 2012, Firebase was globally announced as an independent company Inthe subsequent years, Firebase continued to attract investments and rolled out variousnew products

By October 2014, Firebase had officially been acquired by Google, becoming aversatile application across both mobile and web platforms

Trang 17

Initially, Firebase was the invention of James Tamplin and Andrew Lee, butthrough multiple rounds of fundraising, it officially became a part of Google'sownership in 2014.

2.3 Pros and Cons:

Picture 2 3: Pros and Cons

2.3.1 Pros:

- Free and convenient: You can utilize basic features of Firebase for free

through the Spark service plan For more advanced features, there is a relatively highcost involved Additionally, the process of registering a Firebase account isstraightforward You can register a Firebase account through your Google account

- Easy to use and integrate: Firebase provides a user-friendly and easily

understandable interface After registering your account, simply log in to start utilizing

Trang 18

Firebase features right away Firebase also offers a diverse storage backend with auser-friendly interface, making it convenient for you to choose and manage yourresources.

Additionally, Firebase integrates functionality to assist in establishing criteriafor improving the ranking of your application This not only enhances accessibility forcustomers but also contributes to an increase in traffic

- Meet user needs: Firebase is an integral part of the Google ecosystem.

Consequently, Google continually leverages and extensively develops the strengths andfeatures of Firebase to create services that meet user needs

According to Gartner, approximately 30% of businesses are incorporatingmachine learning (ML) into their workflows Recognizing this trend, Firebase providesmachine learning developers with APIs for various features on the mobile platform.This facilitates the development of applications in the most effective manner

Trang 19

Picture 2 4: Pros and Cons 2.0

- Continuously updated and cross-platform: Firebase undergoes continuous

updates and experiences rapid development, enabling developers to save time inboth the development and marketing of applications Additionally, Firebase is amulti-service platform, evident in its diverse range of services designed for websitedevelopment Developers can easily choose between databases like Firestore orRealtime based on their preferences This versatility contributes to Firebase's appealfor developers seeking efficient and customizable solutions

2.3.2 Cons:

- Limits on application size: Firebase is a component within the Google

ecosystem, operating as a subdomain of Google It's worth noting that Firebase iscurrently restricted in certain countries, including China Furthermore, the entire

Trang 20

infrastructure of Firebase operates on Google Cloud This implies that users cannotrun Firebase applications on cloud service providers other than Google Cloud.

- Limited customization capabilities: Firebase stores its database in JSON

format and doesn't support SQL This can pose challenges in data migration andmanipulation Additionally, Firebase is not an open-source platform, meaningdevelopers cannot modify its source code, hindering the ability to tailor the product

Moreover, developers lack access to the source code, making it difficult toswitch to other providers for larger applications Transitioning to a differentprovider would require rebuilding the entire backend from scratch, addingcomplexity to the process

Trang 21

- Weak security: One of the security weaknesses in Firebase is the storage of

the entire database in JSON format While JSON has the advantage of beinglightweight, language-independent, and user-friendly, in some cases, it can beconsidered a security concern, potentially leading to issues related to informationsecurity

2.4 Realtime Database and Cloud Firestore:

2.4.1 What is Firebase Realtime Database:

Picture 2 6: Firebase Realtime Database

Firebase Realtime Database is a type of cloud-hosted NoSQL database thatenables you to store and synchronize data Notably, the data is stored in JSON formatand is synchronized in real-time across all connected devices

When developing cross-platform applications using SDKs for iOS, Android, andJavaScript, Firebase's Realtime Database ensures that all clients share a version of the

Trang 22

database and automatically updates with the latest data This ensures responsivenessfor mobile applications that require real-time synchronization of state across devices,providing an efficient solution with low latency.

2.4.2 Main function of FRD:

Picture 2 7 Realtime Database functions

Realtime: Firebase employs data synchronization, ensuring that whenever datachanges, all connected devices receive the updates immediately

Offline: Firebase ensures that applications remain functional even when offline,

as the Firebase Realtime Database SDK stores your data locally Upon reestablishing aconnection, the device is updated with any changes it missed and synchronizes thecurrent data with the server

Multi-device Usage: Firebase Realtime Database can be accessed directly frommobile devices or web browsers

Trang 23

Scalability through Database Combination: With Firebase Realtime Database onthe Blaze plan (paid version), scalability is achieved by combining multiple databaseswithin the same Firebase project.

2.4.3 How Firebase Realtime Database works ?

Picture 2 8 : Realtime Database works

Firebase Realtime Database enables you to easily build diverse and secureapplications with a database directly from the client Data is maintained locally, andeven when the application is offline, real-time events continue Upon devicereconnection, the Realtime Database automatically synchronizes local data changeswith data from the server and automatically resolves any conflicts

Firebase Realtime Database provides security rules to determine the datastructure and read-write access, often combined with Firebase Authentication features

As a NoSQL database, Realtime Database is optimized for performance,avoiding the limitations of relational databases Designed for quick responsiveness,

Trang 24

Realtime Database allows you to build an excellent real-time experience that can servemillions of users without concerns about responsiveness.

2.4.4 What is Cloud Firestore ?

Picture 2 9 : Cloud Firestore

Cloud Firestore is Firebase's newly developed database tailored specifically formobile applications It builds upon the foundation of the Realtime Database butintroduces a new and more intuitive data model Compared to the Realtime Database,Cloud Firestore is more feature-rich, faster, and boasts superior scalability

Similar to Firebase Realtime Database, it facilitates data synchronization acrossclient applications through real-time updates and provides offline support for mobileand web devices Cloud Firestore also integrates seamlessly with other Firebase andGoogle Cloud Platform products, including Cloud Functions

2.4.5 Main functions of Cloud Firestore:

Trang 25

Picture 2 10 : Cloud Firestore functions

Flexibility : Cloud Firestore supports flexible data structures with hierarchicaldata modeling Your data is stored in documents, organized into collections.Documents can contain complex objects

Abstract Queries : You can use queries to retrieve individual documents or fetchall documents in a collection that match your query parameters Your queries caninclude multiple filters, combining filters, and sorting

Real-time Updates : Cloud Firestore employs data synchronization to updatedata across all connected devices It is also designed to perform one-time fetch queriesefficiently

Offline Support : Cloud Firestore stores data locally, allowing the application towrite, read, listen, and query data even when the device is offline When the device

Trang 26

comes back online, Cloud Firestore synchronizes all local changes to the CloudFirestore.

Scalability : Derived from the Google Cloud Platform, Cloud Firestore isdesigned to handle the most challenging database needs of the world's largestapplications, ensuring scalability for various use cases

2.4.6 How Cloud Firestore works ?

Picture 2 11 : Cloud Firebase works

Cloud Firestore is a cloud-hosted NoSQL database that can be accessed directlythrough SDKs by iOS, Android, and Web applications Additionally, Cloud Firestore isalso available in SDKs for Node.js, Java, Python, and Go, as well as through REST andRPC APIs

Following the NoSQL data model of Cloud Firestore, data is organized intodocuments that map to values These documents are structured within collections,providing a way to organize data and execute queries

Trang 27

To secure access to your data in Cloud Firestore, you can use FirebaseAuthentication for Android, iOS, and JavaScript, or Identity and Access Management(IAM) This ensures data security and control over who can access it.

2.4.7 Difference between Realtime Database and Cloud Firestore.

Picture 2 12: Difference between Realtime Database and Cloud Firestore.

- Data model:

Trang 28

Picture 2 13: Data model:

Both are NoSQL databases Realtime Database stores data in a JSON tree,making it simpler and easier for basic data storage However, it can becomechallenging to organize complex and hierarchical data when scaling

In contrast, Cloud Firestore stores data in documents organized withincollections Simple data is stored within documents, similar to JSON data storage Forcomplex data, hierarchical structuring can be achieved through subcollections CloudFirestore requires less data normalization and provides more flexibility in how data isorganized and accessed

- Real-time data and offline support:

Trang 29

Picture 2 14: Real-time data and offline support.

Both are the first databases supporting the Realtime SDK and have thecapability to store data locally The Realtime Database only allows offline mode formobile applications on iOS and Android, whereas Cloud Firestore provides offlinesupport for iOS, Android, and even web applications

- Query:

Data can be retrieved, sorted, and filtered from any database through queries

Realtime Database supports queries with sorting, filtering, and limitingfunctionalities In a single query, you can only perform sorting or filtering, not both, onone property

Cloud Firestore supports composite index queries with sorting, filtering, andmerging Cloud Firestore allows the simultaneous use of both filtering and sorting on a

Trang 30

property in a single query The default query type is an index type, where queryperformance scales proportionally to the size of your result set and is independent ofthe data size.

- Stability and performance:

Realtime Database is a mature product with high stability and exhibits very lowlatency, making it suitable for data synchronization

Cloud Firestore offers even higher stability than Realtime Database because itdistributes data across servers globally

- Ability of extension:

Realtime Database can handle up to 100,000 concurrent connections andperform 1,000 writes per second in a single database, so scaling requires datadistribution across different databases

On the other hand, Cloud Firestore scales automatically and seamlessly

- Security:

Trang 31

Picture 2 15: Security of Cloud Firestore and Realtime Database

Realtime Database relies on conventional authentication rules

Cloud Firestore provides a security system that is simple yet more robust.Mobile and web applications utilize the security rules of Cloud Firestore, while server-side applications use Identity and Access Management (IAM)

-Final result:

Both databases can be used together in a Firebase application or project

Cloud Firestore introduces additional features, improved performance, andscalability, with the promise of integrating new features in the future

If you're looking for advanced queries, stronger security rules, and optimizedperformance with some additional advanced features, Cloud Firestore is the suitable

Trang 32

choice Just keep in mind the differences mentioned above if you decide to use bothdatabases or choose one for your mobile application.

2.5 Authentication:

Picture 2 16: Authentication

Firebase Authentication is a feature used to verify users through methods such

as passwords, phone numbers, or linked accounts like Google, Facebook, Twitter, etc

User authentication plays a crucial role in app development However, dealingwith various authentication methods can be time-consuming and labor-intensive

Firebase Authentication addresses this issue by providing a mechanism forsharing IDs across applications, making it easier for users to access and interact withproducts Therefore, it is a highly valuable and convenient feature

Trang 33

2.7 Test Lab:

Trang 34

Picture 2 18: Test Lab

Firebase Test Lab is used to test applications on the cloud platform

By utilizing Test Lab, we can test the functionality of the application acrossvarious devices, allowing us to verify how the app will run on the actual devices used

by users

2.8 Cloud Messaging (FCM):

Trang 35

Picture 2 19: Cloud Mesaging

With Firebase Cloud Messaging, you can send and receive messages for free.The concept of "sending messages" here also refers to pushing notifications

When a new message is sent, users can receive notifications For example, foriPhone users, when there is an email or notification from an application, a small redcircle will appear in the top right corner of the app's icon, or more conveniently, withinthat red circle, the number of notifications or new messages will be displayed

Furthermore, we can also set up messages to be sent only to specific recipients.For instance, sending a notification requesting product feedback to customers whoregularly use the product

2.9 Hosting:

Trang 36

With Firebase Hosting, you can use web pages for both your iOS and Androidapplications.

Trang 37

With the advantages of fast and simple operations, high security, FirebaseHosting helps developers establish applications more easily compared to the process ofself-deployment or using external server services.

2.10 Remote Config:

Picture 2 21: Remote Config

Firebase Remote Config allows you to alter the UI and functionality of an appwithout the need for an app update

This is done by initially setting default values for the app's interface andfunctionality Later, the Remote Config REST API or Firebase Console can be utilized

to override these default values with new settings

Trang 38

CHAPTER III – DESIGN ANALYSIS

3.1: Requirement

3.1.1: Objective

This project aims to achieve an in-depth understanding of Google FirebaseFirestore to develop an application that offers various functionalities related to studentinformation management

3.1.2: Key Software Functions:

- User Account Management (Firebase authentication is optional but can be a good

choice)

User Login (for all users)

Change Profile Picture (for all users)

View the List of System Users

Add a New User: Name, Age, Phone Number, Status (Normal/Locked)Delete a User

Modify User Information

View Login History of a User

- Student Management

View List of Students

Add a New Student

Delete a Student

Update Student Information

Sort the List of Students based on various criteria

Search for Students using multiple criteria

Access Student Details Page

View complete student information on the details screen

- Manage a list of certificates for students:

Trang 39

View the list of certificates

Add a new certificate

Delete a certificate

Update certificate information

- Data Import/Export

Import a list of students from a file

Export the list of students to Excel/CSV

Import a list of certificates for a student from a fileExport the list of certificates to Excel/CSV

3.2 User Account Management

3.2.1 User Login:

When you open the app, you will see a login page as follows:

Trang 40

Picture 3 1: Login

Admin: Logging in with the admin account, you will see the interface for

selecting various functions

Ngày đăng: 01/10/2024, 20:46