Home > Software > Introduction to Firebase

Introduction to Firebase

Date post: 16-Apr-2017
Category:
Author: mustafa-senel
View: 466 times
Download: 59 times
Share this document with a friend
Embed Size (px)
of 30 /30
INTRODUCTION TO FIREBASE Mustafa ŞENEL [email protected] Software Developer @ SONY GSI
Transcript

Introducton to frebase

Introducton to frebaseMustafa [email protected] Developer @ SONY GSI

1

AGENDA What is Firebase ? Use Case Realtime Database Data Modeling Security Rules Pricing Conclusion

2

2

What s frebase?

Firebaseis a mobile and web application platform with tools and infrastructure designed to help developers build high-quality apps*3*https://en.wikipedia.org/wiki/Firebase

3

What s frebase?

A set of tools which provides a full suite for app development Ability to create applications with no server-side programming Backend as a Service4

4

Hstory

Founded in 2011 by Andrew Lee and James Tamplin Initial product was a realtime database Over time it becomes a full suite for app development Acquired by Google in 2014

5

5

What s frebase?

6*https://firebase.google.com/

6

Use case moble appUsually our architecture

7

DatabaseServer / REST APIDevices*Icons made by Madebyoliver from www.flaticon.com

7

Use case moble app8

*Icons made by Madebyoliver from www.flaticon.com

Access via REST or SDK

8

Frebase realtme database

Initial product and the heart of the Firebase platform After a database update, new data is synchronized across all clients within milliseconds NoSQL Json Database9

9

Frebase REST10

Firebase can be used as REST endpoint (append .json to the URL) Usage of HTTP methods (GET, POST, PUT, PATCH, DELETE) as usual Provides a set of Query parameters

10

Frebase SDK11

11

Sdk - Read data (on method)12

Event based query system Provides different event types Listens for data changes at a particular location Callback triggered for the initial data and whenever the data changes

12

Sdk - Read Examples13

13

Sdk - Read data (other methods)14

once Method Access like on method but just one callback and not keep giving updates

off Method Detaches a callback previously attached with on method

14

Sdk wrte data (push method)15

Most common pattern for adding data Generates a new child location and returns its Reference Uses a unique key based on current time Because of the unique key, data is chronologically inserted

15

Sdk - wrte data (other methods)16

set Method Overwrites any data at given location and all child locations

update Method Used to selectively update only the referenced properties at the given location

16

Sdk - Wrte Examples17

17

Sdk - workng OFFLINE18

Offline read and write data possible There are two offline modes Short termLocal in-memory cache Long termDisk persistence Works on Android and IOS

18

Use case We are going to build a mobile application We have entities like User, Channel, Follower, ...

One user can have many channels Each channel only belongs to one user

One channel can have many followers Each follower can follow many channels

19

19

Data modelng - nested nodes20

Might be exactly what we need When we need channels always with full follower information

But Firebase is always loading all json There is no way to exclude properties

20

Data modelng - the elegant way21 Add indexes to resolve two-way relationships Association properties of the relationship could be saved as the value of this node

21

Data modelng

Keep in mind Its a JSON tree Avoid nesting data Flatten data structures Create data that scales22* https://firebase.google.com/docs/database/web/structure-data

22

Securty rules

Default rules are too open Access to everything even if signing in anonymously Mindfully data modeling is essential for real life rules Important rule types .read .write .validate .indexOn23

23

Securty rules - Example24

24

Prcng25*https://firebase.google.com/pricing/ December, 2016

25

Some frebase customers26

* https://firebase.google.com/customers

26

Alternatves27

27

In concluson

Get fast in action Easy to use But sometimes we just need server-side code It is hosted Data needs to be well structured 28

28

lnks29

https://gist.github.com/msenel/8b01bfca1490a490e2cc06a3bcb865ee#file-senel-bbs-firebase-read-js https://gist.github.com/msenel/5e4179b2e78c20968b7102b2bc95f645#file-senel-bbs-firebase-write-js https://firebase.google.com/docs/ https://firebase.google.com/docs/database/web/structure-data https://www.youtube.com/user/Firebase

29

Thank you!

30


Recommended