The Busy Guardian is a web based tool to help Destiny 2 players schedule games with other players. It attempts to match players by time window, gaming platform, and activity interest + experience.
This tool relies on Firebase (Firestore, Auth, Functions, Hosting) and the Bungie API.
You will need a Firebase account with Functions access and a Bungie.net Application API Key, OAuth Client Id and OAuth Client Secret.
Edit bin/source-setup.sh
and change GOOGLE_APPLICATION_CREDENTIALS
to point at your Firebase credentials JSON.
Set your bungie data via function config variables.
$ firebase functions:config:set \
bungie.client.id="CLIENT_ID" \
bungie.client.secret="CLIENT_SECRET" \
bungie.api.key="API_KEY"
Set up your Firebase service account to have the token creator role. See this Stack Overflow question for details.
$ cd functions
$ npm install
$ cd ../bin
$ npm install
$ source bin/source-setup.sh
$ firebase emulators:start
TbG uses a custom lightweight two-way binding framework that can be loaded in browser, in Node, and in Firebase Functions. Each model defines a schema which is then used to build views for forms and display.
Models define a schema which maps to a document and set of fields as well as a view and set of elements. Each schema field maps to a property of the model object. When properties are changed the values are auto-saved back to Firestore. Models can be loaded once, or use listen to automatically whenever Firestore changes.
Collections define a set of models, the same way Firestore does. Collections can be loaded once or listened to for updates.
Views are built using the schema's fields and options. Form elements within views are bound to the model properties, so they will also auto-save to Firestore.
TbG authenticates via the Bungie OAuth2 API. The resulting Bungie.net membership id used the uid for a Firebase Authentication Token generated by the auth function. Bungie.net API keys are stored in Firestore and used to retreive data to initialize the players profile.