Fireship · @fireship

RxFire - Firebase meets RxJS

Uploaded August 24, 2018 · Length 12:23

RxFire - Firebase meets RxJS

Summary

Learn how to use RxFire to build reactive web components with Firebase and StencilJS.

  • rxjs firebase
  • rx fire
  • reactive programming
  • web components
  • stenciljs
  • firebase sdk
  • lazy loading
  • progressive web app
  • google auth
  • firebase authentication

Transcript preview

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

  1. 0:00

    [Music]

  2. 0:06

    one of the biggest challenges for web

  3. 0:08

    developer is to maintain asynchronous

  4. 0:10

    callback based code in firebase

  5. 0:13

    everything is real-time so it only makes

  6. 0:15

    sense that we use the best reactive

  7. 0:16

    programming library out there which is

  8. 0:18

    rxjs in today's video you'll learn about

  9. 0:21

    a brand new officially supported library

  10. 0:23

    from firebase called rx fire we'll use

  11. 0:26

    it along with stencil Jas to compose

  12. 0:27

    full stack reactive web components that

  13. 0:30

    can be used in any JavaScript framework

  14. 0:32

    or just in some plain HTML if you're new

  15. 0:34

    here like and subscribe and grab the

  16. 0:36

    full source code from angular

  17. 0:37

    firebase.com let's start by talking a

  18. 0:40

    little bit more about what rx fire is

  19. 0:41

    and when you would want to use it the

  20. 0:43

    first thing I'll point out is that it's

  21. 0:45

    not a replacement for angular fire - so

  22. 0:47

    you want to continue using angular fire

  23. 0:49

    - in an angular project but it does

  24. 0:51

    provide a way for other frameworks to

  25. 0:53

    have a consistent implementation of

  26. 0:54

    firebase with rxjs so you can get really

  27. 0:57

    good control flow on your real time

  28. 0:59

    streams whether you're using view react

  29. 1:01

    stencil as we'll see later in the video

  30. 1:03

    or just plain JavaScript I recommend

  31. 1:05

    taking a look at the RX fire samples

  32. 1:07

    repo so you can see it in action in a

  33. 1:09

    variety of different settings and

  34. 1:11

    another really cool thing about this

  35. 1:12

    library is that it doesn't take the

  36. 1:14

    firebase SDK as a hard dependency which

  37. 1:17

    opens the door for lazy loading the

  38. 1:19

    firebase SDK is pretty large so if you

  39. 1:21

    can get it out of your critical path

  40. 1:22

    you'll get much quicker page loads for

  41. 1:24

    your progressive web app so what I want

  42. 1:27

    to show you today is how we can take

  43. 1:28

    this library and use it with a web

  44. 1:30

    component tool like stencil j/s to build

  45. 1:33

    a reusable to-do list that you can just

  46. 1:35

    drop into any other app that's already

  47. 1:37

    using firebase there's a ton of

  48. 1:39

    potential here to build web components

  49. 1:41

    that get reused across multiple

  50. 1:42

    applications for example you might build

  51. 1:44

    a chat client that is similar to

  52. 1:46

    intercom or maybe you just want to have

  53. 1:48

    a consistent login button that you can

  54. 1:50

    easily share across multiple web

  55. 1:52

    applications there's just tons of

  56. 1:54

    potential there but it's time to get

  57. 1:55

    moving on to the code I'm going to start

  58. 1:57

    by initializing stencil if you're not

  59. 1:59

    familiar with stencil don't worry it's a