Note: I no longer use Firebase (I switched to Biff, so this repo is not necessarily up-to-date.
This is an example program (a cow-themed version of the board game Clue) meant to demonstrate how to make a web app with ClojureScript and Firebase. It's deployed at cows.jacobobryant.com.
The following requires no knowledge of Clojure or Firebase. Once you have it
running, you can start poking around the code to see how it works. While
running ./task dev
, any Clojure(Script) files you change will be recompiled
automatically.
I've also recorded some commentary on the architecture of this project. The most interesting part is at 25:42, where I explain how you can specify declaratively which Firestore subscriptions the app needs based on its current state.
- At firebase.google.com, create a new project.
- In the "Authentication" section, click "Set up sign-in method." First enable "Email/Password," and then also enable "Email link (passwordless sign-in)." After that, enable sign-in with Google.
- In the side bar, click on "Cloud Firestore" and then "Create database." Accept the defaults.
- Install dependencies: NPM, Clojure and Overmind.
- Clone this repository. Inside the project directory, run
./task setup
. - Run
firebase login
and thenfirebase init
. Select Firestore, Hosting and Functions, and select your existing project. Accept the defaults for everything elses.
- Run
./task dev
. - After Shadow CLJS loads, go to localhost:9630. Hover over "Builds," then check the "main" and "fn" boxes.
- In a new terminal, run
firebase emulators:start
.
The app will be available at localhost:5000.
Run ./task deploy
. The app will be available at
https://your-project-id.web.app
.
Distributed under the EPL v2.0
Copyright © 2020 Jacob O'Bryant.