Fireship · @fireship

Angular Universal with Firebase

Uploaded April 16, 2018 · Length 11:58

Angular Universal with Firebase

Summary

Combine Angular Universal with Firebase to build a search engine optimized JavaScript app with server-side rendering.

  • angular universal
  • firebase
  • server-side rendering
  • search engine optimization
  • javascript
  • angular universal with firebase

Transcript preview

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

  1. 0:00

    [Music]

  2. 0:01

    today we're finally going to answer the

  3. 0:04

    question of how do we combine firebase

  4. 0:05

    with angular Universal to build a search

  5. 0:08

    engine optimized JavaScript app recent

  6. 0:10

    changes to angular fire to now make it

  7. 0:12

    possible to perform server-side

  8. 0:14

    rendering with Universal what this means

  9. 0:16

    is that our apps content can be

  10. 0:18

    understood by search engines and used by

  11. 0:20

    social media link BOTS and we might even

  12. 0:22

    get some good page load performance

  13. 0:23

    gains out of it if you're new here make

  14. 0:26

    sure to LIKE and subscribe and I highly

  15. 0:27

    recommend that you follow along with the

  16. 0:29

    source code on angular firebase comm

  17. 0:31

    first let's talk about what server-side

  18. 0:33

    rendering is normally we just let the

  19. 0:35

    browser parcel of the JavaScript and

  20. 0:37

    render it out to HTML but this becomes a

  21. 0:40

    problem if your app has routes that need

  22. 0:42

    to be indexed in a search engine or

  23. 0:44

    shared on social media most bots that

  24. 0:47

    visit your site only understand HTML and

  25. 0:49

    don't make any effort to parse the

  26. 0:51

    JavaScript that's there what we can do

  27. 0:53

    is make our angular app behave more like

  28. 0:55

    a traditional web application that

  29. 0:57

    responds with HTML from a server on the

  30. 1:00

    first page visit it will render the app

  31. 1:02

    to HTML and then send it over to the

  32. 1:04

    browser which will then take over and

  33. 1:06

    transition it to work just like a

  34. 1:08

    regular angular app in this demo I'll

  35. 1:10

    show you how to go from 0 to deployed

  36. 1:12

    angular Universal app and will generate

  37. 1:14

    all the content with this collection of

  38. 1:16

    animals that I have stored in the

  39. 1:17

    firestore database I should warn you

  40. 1:19

    that we have a lot of code to get

  41. 1:20

    through but most of its configuration

  42. 1:22

    related stuff that you can just copy and

  43. 1:24

    paste into your project but I documented

  44. 1:26

    everything step-by-step in the main

  45. 1:28

    article so you can follow along with

  46. 1:29

    that if you get lost step one is to

  47. 1:33

    generate a new angular app and make sure

  48. 1:35

    that it has a routing module then

  49. 1:37

    install the latest version of angular

  50. 1:39

    fire 2 and firebase and then send a

  51. 1:41

    thank-you card to James from firebase

  52. 1:43

    because he made some pretty epic changes

  53. 1:45

    to this library to make Universal

  54. 1:46

    support possible after that's done

  55. 1:48

    install a platform server from angular

  56. 1:50

    and if you're doing lazy loading you'll

  57. 1:53

    also need this NG Universal module map

  58. 1:55

    NG factory loader and TS loader as well

  59. 1:58

    when it comes to social media bots