Multiplayer backgammon game that uses Firebase for persistence
Branch: master
Clone or download
Latest commit ddd9bda May 18, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
resources/public extract project from talk directory Jan 13, 2018
src/cljs/bg Inserted more comprehensible template code from https://firebase.goog… Apr 18, 2018
test/cljs/bg extract project from talk directory Jan 13, 2018
.firebaserc extract project from talk directory Jan 13, 2018
.gitignore extract project from talk directory Jan 13, 2018
README.md Update README.md May 18, 2018
database.rules.json extract project from talk directory Jan 13, 2018
firebase.json
presentation.pdf fixes typo Jan 19, 2018
project.clj extract project from talk directory Jan 13, 2018

README.md

backgammon

Multiplayer backgammon game that uses Firebase for shared state.

This project was used as the example for this talk I gave at IN/Clojure 2018 on titled "Serverless Applications using ClojureScript and Firebase."

A pdf of the presentation is found in this repo. Unfortunately, the gifs don't work but this was the best way of exporting from my presentation software.

Necessary steps to run:

  1. Sign up for firebase
  2. Make a project through the console.
  3. Grab the configuration from the Firebase console and shove it here. (Pass it as an argument to the firebase.initializeApp function).
  4. Modify .firebaserc to use your project's id.
  5. lein cljsbuild once min
  6. firebase deploy (Local project won't work till this happens either because this will change some authentication settings for your firebase realtime database)
  7. lein figwheel dev for local development.

Additional Important Notes

This project currently opens up the Firebase Realtime Database (FRD) to unauthenticated users (check out the database.rules.json) file. This is not ideal but was a simplification for the talk. If adapting this for another project, you should authenticate users and have some restrictions on what paths in your FRD they can access.

Development Mode

Run application:

lein clean
lein figwheel dev

Figwheel will automatically push cljs changes to the browser.

Wait a bit, then browse to http://localhost:3449.

Production Build and Deploy

To compile clojurescript to javascript:

lein clean
lein cljsbuild once min
firebase deploy