Opinionated TypeScript monorepo for Firebase projects, brought to you by the AlgoRaven team.
- Define models and protocols in
idl
(interface definition language). - Implement protocols in the
api
with ease. - Call the protocols from
web
with the built-in client. - Deploy the whole thing to Firebase with a single
firebase deploy
.
-
Clone this repo locally.
-
Create a Firebase project with your choice of name.
-
Enable the Firestore Database by clicking
Create Database
. Choose the mode and region of your choice, butTest
mode will help you get set up faster. -
Install the Firebase CLI in your command line via
yarn install -g firebase-tools
. -
Log into Firebase via
firebase login
. -
Run
yarn install
to install all project dependencies. -
Run
yarn setup
to set up the emulators. -
Select
Use an existing project
and pick your recently created project. When askedWhich Firebase emulators do you want to set up?
, press Enter to set up defaults. Press Y and Enter to use the pre-defined ports (don't change them). -
Go back to Firebase, select your app, click on
Project Settings
,create a new web app at the bottom,
enable Firebase Hosting,
and then click
Register app
. -
Copy/paste the properties of
firebaseConfig
intoFIREBASE_CONFIG
inweb/src/util/env.ts
. -
Run your app with
yarn start
. Use your app atlocalhost:3000
. Use the Firebase emulators atlocalhost:4269
. -
Run
firebase deploy
to deploy both your backend and frontend. Your frontend will be available athttps://myproject.web.app
and your backend will be available athttps://us-central1-myproject.cloudfunctions.net/app
.
You may be presented with the following:
Error: Your project myproject must be on the Blaze (pay-as-you-go) plan to complete this command. Required API cloudbuild.googleapis.com can't be enabled until the upgrade is complete. To upgrade, visit the following URL:
https://console.firebase.google.com/project/myproject/usage/details
In this case, you'll have to enable the Blaze plan via that URL.