Fireship · @fireship

Host Multiple Apps or Websites on Firebase

Uploaded August 30, 2018 · Length 4:36

Host Multiple Apps or Websites on Firebase

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.

  1. 0:00

    [Music]

  2. 0:06

    one of the most frustrating limitations

  3. 0:08

    of firebase is that you can only host

  4. 0:10

    one website per project well at least

  5. 0:12

    that was the case until they announced

  6. 0:13

    multi site hosting on August 21st which

  7. 0:16

    also happens to be my birthday and this

  8. 0:18

    is an awesome birthday present because

  9. 0:19

    it solves many of the problems that I've

  10. 0:21

    run into in the past for example I've

  11. 0:23

    had situations where I need an admin

  12. 0:24

    site and a public-facing site that both

  13. 0:26

    share the same database and cloud

  14. 0:28

    functions and I've also render the same

  15. 0:30

    problem with internationalization where

  16. 0:32

    I have different versions of my app for

  17. 0:34

    the languages that I support in today's

  18. 0:36

    video you'll learn how to solve these

  19. 0:37

    problems by deploying multiple

  20. 0:38

    progressive web apps to a single

  21. 0:40

    firebase project if you're new here like

  22. 0:42

    and subscribe and grab the full source

  23. 0:44

    code from angular firebase com

  24. 0:46

    in this video I'm using angular's

  25. 0:48

    internationalization library to create

  26. 0:50

    different builds for my app based on the

  27. 0:52

    languages that I support I will cover

  28. 0:54

    this in a future video but the end

  29. 0:55

    result is that in your distal der you'll

  30. 0:57

    have multiple builds for the different

  31. 0:59

    languages for example here we have the

  32. 1:01

    default English Plus Spanish and French

  33. 1:03

    at this point we don't have firebase

  34. 1:05

    setup so let's go ahead and do that and

  35. 1:07

    see if we can get these three different

  36. 1:08

    apps deployed to the same firebase

  37. 1:10

    project each on their own unique URL the

  38. 1:13

    first step is to make sure that we're

  39. 1:14

    updated on firebase tools - version 4.2

  40. 1:17

    or greater so run NPM I flag g4 global

  41. 1:21

    and firebase tools at latest then run

  42. 1:24

    firebase version just to double-check

  43. 1:26

    that you're at 4.2 from there we'll run

  44. 1:28

    firebase the net hosting just to set up

  45. 1:30

    hosting in this project then instead of

  46. 1:32

    the public folder we'll want to point to

  47. 1:34

    the dist folder with our default app

  48. 1:36

    which is just our English app in this

  49. 1:38

    case we can say yes to single page app

  50. 1:40

    and then we don't want to overwrite any

  51. 1:42

    of our existing code running this

  52. 1:44

    command gives us a firebase JSON config

  53. 1:46

    file that we can use to set up our multi

  54. 1:48

    site hosting

  55. 1:49

    you'll notice that the hosting property

  56. 1:51

    is currently an object let's highlight

  57. 1:53

    it and add brackets to switch it to an

  58. 1:55

    array then we'll need to add an

  59. 1:57

    additional property to each hosting

  60. 1:59

    object called target the target just