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

Enhance your app's backend with Cloud Functions for Firebase (ServerlessDays Hamburg 2019)

Enhance your app's backend with Cloud Functions for Firebase (ServerlessDays Hamburg 2019)

Doug Stevenson

February 14, 2019
Tweet

More Decks by Doug Stevenson

Other Decks in Technology

Transcript

  1. Enhance your app's
    backend with Cloud
    Functions for Firebase
    Doug Stevenson
    @CodingDoug
    Codelab: bit.ly/cf3-codelab

    View full-size slide

  2. @CodingDoug
    bit.ly/what-is-firebase

    View full-size slide

  3. @CodingDoug
    serverless / JavaScript / node.js

    View full-size slide

  4. @CodingDoug
    Cloud Functions is a Google Cloud product

    View full-size slide

  5. @CodingDoug
    Firebase adds tools and APIs

    View full-size slide

  6. @CodingDoug
    What is “serverless”?
    ● Servers (!!)
    ● No maintenance
    ● Automatic scaling up and down
    ● Pay only for what you use
    ● Event-driven

    View full-size slide

  7. @CodingDoug
    Cloud Functions is event-driven
    Cloud
    Functions
    event providers
    Cloud
    Storage
    Firebase
    Auth
    Crashlytics
    Cloud
    Firestore
    function (event) {
    doStuff(event)
    }
    trigger
    emit events

    View full-size slide

  8. @CodingDoug
    Cloud Functions scales up and down with load
    Cloud
    Functions
    function (event) {
    doStuff(event)
    }

    View full-size slide

  9. @CodingDoug
    Cloud Firestore
    Firebase Crashlytics
    Firebase Authentication
    Firebase Realtime Database
    HTTPS endpoints
    Cloud Pub/Sub
    Cloud Storage
    Google Analytics for Firebase
    Event providers

    View full-size slide

  10. @CodingDoug
    Why use Cloud Functions?
    ● Don’t repeat yourself.
    ○ Share common app logic between app platforms.
    ● Be fast and reliable.
    ○ Offload work to be done in the background.
    ● Don’t trust the user’s device.
    ○ Secure your sensitive code.

    View full-size slide

  11. @CodingDoug
    When NOT to use Cloud Functions?
    ● Your app can’t tolerate “cold start” times.
    ○ Instead, maintain your own servers 24/7.
    ● You have heavyweight work to do ( > 9 min, > 2GB mem/disk )
    ○ Delegate work to App Engine or Compute Engine
    ● You need to keep a socket open or do streaming
    ○ No easy alternative

    View full-size slide

  12. @CodingDoug
    Resources
    What is Firebase? bit.ly/what-is-firebase
    Cloud Functions docs bit.ly/cf3-docs
    Video tutorials bit.ly/cf3-videos
    Sample code bit.ly/cf3-samples
    Codelab bit.ly/cf3-codelab
    My samples gist.github.com/CodingDoug

    View full-size slide

  13. @CodingDoug
    Resources
    Universal translator code github.com/CodingDoug

    View full-size slide

  14. Thank you!
    @CodingDoug
    firebase.google.com

    View full-size slide