Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Supercharge your app with Firebase and Stream

Peter Friese
December 03, 2022

Supercharge your app with Firebase and Stream

In this talk Peter and Stefan take a look how you can enhance your application with the power of Firebase and Stream. Specifically they will talk about how you can leverage the power of Firebase Extensions to give your applications superpowers with pre-built enhancements to the Firebase ecosystem.

Peter Friese

December 03, 2022
Tweet

More Decks by Peter Friese

Other Decks in Technology

Transcript

  1. Peter Friese Peter Friese Stefan Blos Stefan Blos Developer Advocate,

    Firebase Developer Advocate, Firebase Developer Advocate, Stream Developer Advocate, Stream @pete rf riese @pete rf riese @stefanjblos @stefanjblos
  2. UI Components 􀟜 Stream Overview Infrastructure Authentication 􀎥 • UIKit

    • Swi ft UI • JWT • BYOS* * Bring Your Own Server • Managed service
  3. Firebase Backend Cloud Storage Cloud Firestore Updated tech stack Authentication

    Client Chat Backend A miracle happens here ? Stream Stream UI +
  4. Firebase Backend Cloud Storage Cloud Firestore Updated tech stack Authentication

    Client https://getstream.io/blog/ vapor-swift-stream-server/ ? Custom Backend Vapor Chat Backend Stream Stream UI +
  5. Firebase Backend Cloud Storage Cloud Firestore Updated tech stack Authentication

    Client Cloud Functions Stream UI + Chat Backend Stream
  6. Firebase Backend Cloud Storage Cloud Firestore Updated tech stack Authentication

    Client Cloud Functions Extensions Chat Backend Stream Stream UI +
  7. Live Demo - Email Install Firebase Extension Trigger sending email

    (via Firestore) Add UI to send the email 􀆅
  8. Live Demo - Email Install Firebase Extension Trigger sending email

    (via Firestore) Add UI to send the email 􀆅 􀆅
  9. Live Demo - Email Install Firebase Extension Trigger sending email

    (via Firestore) Add UI to send the email 􀆅 􀆅 􀆅
  10. name: auth-chat version: 0.2.0 specVersion: v1beta displayName: Authenticate with Stream

    Chat description: Synchronizes Firebase Authentication users with Stream, and creates and revoke Stream Chat authentication tokens. license: Apache-2.0 author: authorName: Stream url: https: / / getstream.io/ sourceUrl: https: // github.com/GetStream/stream-firebase-extensions/tree/ main/auth-chat billingRequired: true params: - param: LOCATION label: Cloud Functions location description: >- Where do you want to deploy the functions created for this extension? type: select extension.yaml
  11. import * as admin from "firebase-admin"; import * as functions

    from "firebase-functions"; import { StreamChat } from "stream-chat"; admin.initializeApp(); const serverClient = StreamChat.getInstance( process.env.STREAM_API_KEY!, process.env.STREAM_API_SECRET!, ); // When a user is created in Firebase an associated Stream account is also created. export const createStreamUser = functions.auth.user().onCreate(async (user) => { functions.logger.log("Firebase user created", user); / / Create user using the serverClient. const response = await serverClient.upsertUser({ id: user.uid, name: user.displayName, email: user.email, image: user.photoURL, }); index.ts
  12. import * as functions from "firebase-functions"; import { StreamChat }

    from "stream-chat"; admin.initializeApp(); const serverClient = StreamChat.getInstance( process.env.STREAM_API_KEY!, process.env.STREAM_API_SECRET!, ); // When a user is created in Firebase an associated Stream account is also created. export const createStreamUser = functions.auth.user().onCreate(async (user) => { functions.logger.log("Firebase user created", user); / / Create user using the serverClient. const response = await serverClient.upsertUser({ id: user.uid, name: user.displayName, email: user.email, image: user.photoURL, }); functions.logger.log("Stream user created", response); return response; }); index.ts