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
apiwith ease. - Call the protocols from
webwith 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, butTestmode 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 installto install all project dependencies. -
Run
yarn setupto set up the emulators. -
Select
Use an existing projectand 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
firebaseConfigintoFIREBASE_CONFIGinweb/src/util/env.ts. -
Run your app with
yarn start. Use your app atlocalhost:3000. Use the Firebase emulators atlocalhost:4269. -
Run
firebase deployto deploy both your backend and frontend. Your frontend will be available athttps://myproject.web.appand 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.