0% found this document useful (0 votes)
6 views21 pages

Chapter 3 Database

Chapter Three discusses mobile app database components, focusing on Firebase's two database offerings: Realtime Database and Firestore. It highlights their differences in data structure, querying capabilities, scalability, and performance, with Firestore being recommended for new projects due to its flexibility and advanced features. The chapter also outlines steps to add Firebase to a Flutter app, including creating a Firebase project and integrating necessary configurations.

Uploaded by

thelasthockage
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views21 pages

Chapter 3 Database

Chapter Three discusses mobile app database components, focusing on Firebase's two database offerings: Realtime Database and Firestore. It highlights their differences in data structure, querying capabilities, scalability, and performance, with Firestore being recommended for new projects due to its flexibility and advanced features. The chapter also outlines steps to add Firebase to a Flutter app, including creating a Firebase project and integrating necessary configurations.

Uploaded by

thelasthockage
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 21

CHAPTER THREE

Mobile app database


components
Firebase database

By Workie G.
Outline
 What is database?

 Client side/Server side

 Mobile app database components


Client side/Server side
 Mobile app server-side development, also known
as backend development,
 involves creating the code that runs on a server to
handle the app's logic, data storage, and
communication with the mobile client.
 Mobile app backend development is an essential
part of building a mobile application.
Client side/Server side
 It involves creating and managing the server-side
components of the app that handle:
 data storage,

 authentication,

 user management, and

 communication between the app and databases or


other services.
Firebase offers two types of databases

 Firebase Realtime Database

 Firebase Firestore.
Firebase offers two types of databases

 Both databases offer cloud-based NoSQL solutions,


but Firestore is the newer, more powerful version.
 Firebase Realtime Database and Firebase Fire
store are
 both cloud-based databases offered by Firebase,

 a platform developed by Google for building mobile


and web applications.
 They are used to store and sync data in real time
across all connected clients (like mobile apps or
websites).
1. Firebase Realtime Database

 The Realtime Database is Firebase's original


database offering, and it is primarily a NoSQL
database.
 It's structured as a JSON tree, where data is stored in
a flat, hierarchical format.
 Real-time synchronization: One of its standout
features is the ability to synchronize data across all
connected clients in real-time.
 When data changes in the database, all clients
listening to that data are updated instantly.
1. Firebase Realtime Database

 Offline support: It supports offline usage by


caching data locally and synchronizing it once the
client goes back online.
 Data structure: Data is structured as a large JSON
object, and it's more challenging to query deeply
since you must design your database with this in
mind.
 Use case: Great for applications that need real-time
updates, such as chat apps or live dashboards.
1. Firebase Realtime Database

 2. Firebase Firestore

 Firestore is Firebase’s newer and more advanced


database offering.
 It’s a NoSQL database but is structured as
documents and collections, which is more flexible
and scalable compared to the Realtime Database.
1. Firebase Realtime Database
 Data structure: Firestore stores data in documents,
which are organized into collections.
 Documents can contain fields like strings,
numbers, booleans, and even nested objects or
arrays.
 This structure makes it easier to organize and query
your data compared to the flat JSON tree
structure in Realtime Database.
1. Firebase Realtime Database
 Real-time synchronization: Like the Realtime
Database, Firestore also provides real-time
updates and synchronization across clients.
 However, it’s optimized for more complex queries.
1. Firebase Realtime Database
 Offline support: Firestore also supports offline
functionality with automatic syncing when the app
comes online.
 Scalability: Firestore is designed for better
scalability than the Realtime Database. It can handle
more complex data models and larger datasets.
 Querying: Firestore offers more advanced querying
features, such as compound queries, range queries,
and indexing.
1. Firebase Realtime Database
 In general, Firestore is recommended for new
projects due to
 its flexibility,

 scalability, and

 richer feature set

 but Realtime Database may still be useful for


smaller, simpler apps where real-time updates are
crucial.
Difference between Realtime Database
and firestore
 Data Structure:

 Realtime Database: Flat JSON tree.

 Firestore: Documents and collections.

 Querying:

 Realtime Database: Limited querying options,


especially as your data structure grows in complexity.
 Firestore: More advanced querying capabilities,
including compound queries and filtering.
Difference between Realtime Database
and firestore
 Scalability:

 Realtime Database: Scales, but can be less efficient


with large datasets.
 Firestore: Designed to scale more efficiently,
especially with larger and more complex data models.
 Performance:

 Realtime Database: Might be better for simpler apps


with small, real-time data needs.
 Firestore: Better for more complex, scalable apps with
advanced querying and data structure needs.
Firebase fire store

Creating beautiful mobile


applications using Flutter and
Firebase
Add Firebase to your Flutter
app
1. Create a Firebase Project
Go to the Firebase Console: Navigate to the Firebase
Console.
Click on "Add Project": Follow the prompts to create a
new project.
Firebase will ask you to provide a project name and
agree to their terms.
Enable Google Analytics (optional): You can choose
whether or not to enable Google Analytics for your
project during the setup process.
Add Firebase to your Flutter
app
2. Add Firebase to Your Mobile App

For Android:
Go to Your Project in Firebase Console: Once the
project is created, go to the Firebase console and
select your project.
Click on "Add App": Choose Android as the platform.

Download the google-services.json file: This file


contains necessary Firebase configuration details.
Add Firebase to your Flutter
app
 Add the google-services.json file to your project:

 Move the google-services.json file into the app/


folder of your Android project.
 Add Firebase SDK dependencies:

 In your project-level build.gradle, ensure the


classpath is added:
Add Firebase to your Flutter
app
 In your app-level build.gradle, apply the Google
services plugin and add dependencies for Firebase
Firestore:
 apply plugin: 'com.google.gms.google-services' //
Apply at the bottom of the file
Thanks
?

You might also like