Fireship · @fireship

Firebase in 100 Seconds

Uploaded February 17, 2022 · Length 2:35

Firebase in 100 Seconds

Summary

firebase suite of tools for building apps and managing infrastructure on google cloud platform

  • firebase
  • google cloud
  • backend as a service
  • serverless computing
  • cloud functions
  • firebase sdk
  • firestore
  • firebase security rules
  • firebase cloud functions

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    firebase a suite of tools for building

  2. 0:02

    apps and managing infrastructure on top

  3. 0:04

    of google cloud platform it was founded

  4. 0:06

    by james tamplin and andrew lee in 2011

  5. 0:09

    after they discovered that developers

  6. 0:10

    were using their chat software to manage

  7. 0:12

    non-chat application data this inspired

  8. 0:15

    them to create a real-time database a

  9. 0:17

    json database that automatically stays

  10. 0:19

    in sync with your front-end application

  11. 0:21

    it was later expanded to support user

  12. 0:23

    authentication and website hosting to

  13. 0:25

    act as a complete backend as a service

  14. 0:27

    in 2014 it was acquired by google where

  15. 0:29

    it was further expanded with serverless

  16. 0:31

    computing via cloud functions push

  17. 0:32

    notifications via cloud messaging and

  18. 0:34

    other google services like analytics and

  19. 0:37

    admob in 2017 google acquired fabric

  20. 0:39

    from twitter and also launched a new

  21. 0:41

    document database called firestore to

  22. 0:43

    support a wider range of applications

  23. 0:45

    most importantly though firebase

  24. 0:46

    provides software development kits for

  25. 0:48

    virtually every platform to manage and

  26. 0:50

    scale this infrastructure with little to

  27. 0:52

    no back-end code to build a full stack

  28. 0:54

    application right now create a free

  29. 0:55

    firebase project then open up some code

  30. 0:57

    for your favorite front-end platform

  31. 0:59

    install the firebase sdk then connect it

  32. 1:01

    to the cloud with your project

  33. 1:02

    credentials once initialized you can

  34. 1:04

    start interacting with your backend

  35. 1:06

    resources first we might want to know if

  36. 1:07

    the user is logged in or not we can

  37. 1:09

    listen to the current user with the on

  38. 1:11

    off state changed function the user will

  39. 1:13

    be null at first but we can log them in

  40. 1:14

    with their google account using the sign

  41. 1:16

    in with pop-up function now that we have

  42. 1:18

    a user logged in we might want to store

  43. 1:20

    something in a database we can make a

  44. 1:22

    reference to a document in firestore

  45. 1:23

    then write json data to it while making

  46. 1:25

    a reference to the current user's user

  47. 1:27

    id but the amazing thing is that we can

  48. 1:29

    listen to updates to that data in real

  49. 1:31

    time by simply referencing the document

  50. 1:33

    using the onsnapshot function anytime

  51. 1:35

    the data changes on the server it'll be

  52. 1:37

    reflected in the ui with zero latency

  53. 1:39

    thanks to optimistic updates out of the

  54. 1:41

    box but that doesn't seem very secure

  55. 1:43

    how do we control who has access to the

  56. 1:44

    database firestore security rules allow

  57. 1:46

    you to define access control logic in a

  58. 1:49

    simple readable format with common

  59. 1:50

    expression language you can do almost

  60. 1:52

    everything from the front end but when

  61. 1:53

    you do need to run server-side code

  62. 1:55

    firebase cloud functions provides a

  63. 1:56

    tightly integrated serverless backend

  64. 1:59

    not only does it allow you to create