Fireship · @fireship
Angular Universal with Firebase
Uploaded April 16, 2018 · Length 11:58
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.
- 0:00
[Music]
- 0:01
today we're finally going to answer the
- 0:04
question of how do we combine firebase
- 0:05
with angular Universal to build a search
- 0:08
engine optimized JavaScript app recent
- 0:10
changes to angular fire to now make it
- 0:12
possible to perform server-side
- 0:14
rendering with Universal what this means
- 0:16
is that our apps content can be
- 0:18
understood by search engines and used by
- 0:20
social media link BOTS and we might even
- 0:22
get some good page load performance
- 0:23
gains out of it if you're new here make
- 0:26
sure to LIKE and subscribe and I highly
- 0:27
recommend that you follow along with the
- 0:29
source code on angular firebase comm
- 0:31
first let's talk about what server-side
- 0:33
rendering is normally we just let the
- 0:35
browser parcel of the JavaScript and
- 0:37
render it out to HTML but this becomes a
- 0:40
problem if your app has routes that need
- 0:42
to be indexed in a search engine or
- 0:44
shared on social media most bots that
- 0:47
visit your site only understand HTML and
- 0:49
don't make any effort to parse the
- 0:51
JavaScript that's there what we can do
- 0:53
is make our angular app behave more like
- 0:55
a traditional web application that
- 0:57
responds with HTML from a server on the
- 1:00
first page visit it will render the app
- 1:02
to HTML and then send it over to the
- 1:04
browser which will then take over and
- 1:06
transition it to work just like a
- 1:08
regular angular app in this demo I'll
- 1:10
show you how to go from 0 to deployed
- 1:12
angular Universal app and will generate
- 1:14
all the content with this collection of
- 1:16
animals that I have stored in the
- 1:17
firestore database I should warn you
- 1:19
that we have a lot of code to get
- 1:20
through but most of its configuration
- 1:22
related stuff that you can just copy and
- 1:24
paste into your project but I documented
- 1:26
everything step-by-step in the main
- 1:28
article so you can follow along with
- 1:29
that if you get lost step one is to
- 1:33
generate a new angular app and make sure
- 1:35
that it has a routing module then
- 1:37
install the latest version of angular
- 1:39
fire 2 and firebase and then send a
- 1:41
thank-you card to James from firebase
- 1:43
because he made some pretty epic changes
- 1:45
to this library to make Universal
- 1:46
support possible after that's done
- 1:48
install a platform server from angular
- 1:50
and if you're doing lazy loading you'll
- 1:53
also need this NG Universal module map
- 1:55
NG factory loader and TS loader as well
- 1:58
when it comes to social media bots


