Introduction to Firebase - Developer Sam · Introduction to Firebase Sam Zhou & Jessica Hong. What...

17
Introduction to Firebase Sam Zhou & Jessica Hong

Transcript of Introduction to Firebase - Developer Sam · Introduction to Firebase Sam Zhou & Jessica Hong. What...

Introduction to Firebase

Sam Zhou & Jessica Hong

What is Firebase?

Serverless Computing

● No worrying about underlying infrastructure and hardware choices

● Scale Automatically

● Save $$$

Various Options In BaaS Spectrum

Cloud Service Provider ManagedLess Flexible

Self ManagedMore Flexible

FaaS:ServerlessFirebase Functions

IaaS:VM

KubernetesPaaS:App EngineHeroku

Firebase

Firebase Features

Why Samwise Switched

Demo Time!

Real Time Capabilities

● Real time capabilities out of box○ Long pulling

Traditional Approach: ID Provisioning

function editTask(taskId, change) { fetch(`/task/edit/${taskId}`, ...) // ...}

app.post(‘/task/add’, (req, resp) => { db.add(req.body) .then(id => resp.send(id));});

latency!

latency!latency!

function addTask(task) { fetch(‘/task/add’, ...) .then(taskId => { // ... // ... });}

Without taskId from server, cannot call editTask

Realtime Updates: Bad Approach

setTimeInterval(() => { fetch(‘/tasks’).then(resp => { ... });}, 100);

Very Inefficient!

Fronted DB Operations

Frontend DB Operations

What about Security?

How We Use Firebase

● Authentication

● Security - Firestore Configs

● Firestore

● Firebase Functions

Frontend: React

Frontend DB Operations

Firebase Functions

Firestore Database

Firebase Dispatcher

Problem and Solutions: Cold Starting

Frontend

Firestore

Fast Real-time sync

Firebase Functions

Push Events to

Potentially slower due to cold start

Real-time data sync won’t be blocked by slower analytics data collection.

Q&A

http://tinyurl.com/dev-sesh-15