Fireship · @fireship
Host Multiple Apps or Websites on Firebase
Uploaded August 30, 2018 · Length 4:36
Summary
firebase multi site hosting, deploy multiple apps or websites to a single firebase project
- firebase multi site hosting
- firebase hosting multiple apps
- firebase deploy multiple websites
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
[Music]
- 0:06
one of the most frustrating limitations
- 0:08
of firebase is that you can only host
- 0:10
one website per project well at least
- 0:12
that was the case until they announced
- 0:13
multi site hosting on August 21st which
- 0:16
also happens to be my birthday and this
- 0:18
is an awesome birthday present because
- 0:19
it solves many of the problems that I've
- 0:21
run into in the past for example I've
- 0:23
had situations where I need an admin
- 0:24
site and a public-facing site that both
- 0:26
share the same database and cloud
- 0:28
functions and I've also render the same
- 0:30
problem with internationalization where
- 0:32
I have different versions of my app for
- 0:34
the languages that I support in today's
- 0:36
video you'll learn how to solve these
- 0:37
problems by deploying multiple
- 0:38
progressive web apps to a single
- 0:40
firebase project if you're new here like
- 0:42
and subscribe and grab the full source
- 0:44
code from angular firebase com
- 0:46
in this video I'm using angular's
- 0:48
internationalization library to create
- 0:50
different builds for my app based on the
- 0:52
languages that I support I will cover
- 0:54
this in a future video but the end
- 0:55
result is that in your distal der you'll
- 0:57
have multiple builds for the different
- 0:59
languages for example here we have the
- 1:01
default English Plus Spanish and French
- 1:03
at this point we don't have firebase
- 1:05
setup so let's go ahead and do that and
- 1:07
see if we can get these three different
- 1:08
apps deployed to the same firebase
- 1:10
project each on their own unique URL the
- 1:13
first step is to make sure that we're
- 1:14
updated on firebase tools - version 4.2
- 1:17
or greater so run NPM I flag g4 global
- 1:21
and firebase tools at latest then run
- 1:24
firebase version just to double-check
- 1:26
that you're at 4.2 from there we'll run
- 1:28
firebase the net hosting just to set up
- 1:30
hosting in this project then instead of
- 1:32
the public folder we'll want to point to
- 1:34
the dist folder with our default app
- 1:36
which is just our English app in this
- 1:38
case we can say yes to single page app
- 1:40
and then we don't want to overwrite any
- 1:42
of our existing code running this
- 1:44
command gives us a firebase JSON config
- 1:46
file that we can use to set up our multi
- 1:48
site hosting
- 1:49
you'll notice that the hosting property
- 1:51
is currently an object let's highlight
- 1:53
it and add brackets to switch it to an
- 1:55
array then we'll need to add an
- 1:57
additional property to each hosting
- 1:59
object called target the target just


