Skip to content

Developer Guide

Brendan Price edited this page Mar 9, 2023 · 16 revisions

This guide features all the information you will need to know to contribute, like:

Prerequisites

Note: Linux, Windows, and MacOS based developers will have the same setup prerequisites/instructions

Fork Repository

To make changes to D2Synergy, you will need to fork the repository, then push any changes to your fork. You can then make a pull request so that I (or someone else that's lucky enough) can review it, and merge it to the main branch.

You can follow the below steps as a simple how-to:

  1. Fork the repository
  2. Make your changes to the code
  3. Push the changes to your fork using Git or GitHub desktop
  4. Submit a pull request for review

Create Bungie.net Application

In other words, this is getting your own API key, so that you are able to access the API and fetch player data.

  1. Sign into Bungie.net
  2. Navigate to Bungie.net Developer Portal
  3. Click "Create New App" and give your app a name
  4. Set the OAuth Client Type to Confidential
  5. Set the Redirect URL to https://localhost:5500/user.html (1)
  6. Check all the boxes under Scope, except for Read your Destiny 1 Vendor and Advisor information
  7. Set the Origin Header to http://localhost:5500 (1)
  8. Check the box at the bottom to agree to the ToS and then click "Create New App"

You can now see your new applications' credentials. We are going use this for Set-Up Workspace

(1) Note: Refer to step 2 of Set-Up Workspace if you want to use a different port number.

Set-Up Workspace

Setting up your workspace includes, making sure your chosen port is free, and entering Bungie.net application credentials.

  1. Open the forked repository in Visual Studio Code
  2. If you want to use another port number of your choice, enter into snowpack.config.js, in the devOptions.port value. Otherwise leave this value alone. (default is 5500)
  3. Create a file called .env, in the root directory
  4. Base64 encode your client id and client secret together in the following format, to get the AUTH .env variable:
    In JavaScript you would do: Base64.encode("<clientid>:<clientsecret>") (1)
  5. Set CLIENT_ID as your client id and API_KEY as your API key

(1) Note: <clientid> is a field where you replace the entire thing (<clientid>) with your client id from your Bungie.net app you just made. This rule applies for every occurrence of <> and whatever contents it contains.

If you want to use a port number of your choice, remember to change all references from the default 5500

Configure Development Server

We now have to install all the packages and use the command(s), that are listed inside of package.json.

  1. Open a new terminal in VSC and enter npm i. This will install all the packages required to run D2 Synergy in development mode.
  2. We have all the modules installed to node_modules. Now we can run npm run dev to start the dev server.

Your default web browser will open the dev server URL at http://localhost:5500. The development server runs on snowpack.js which is known as a Bundler. Snowpack will also listen for changes and refresh the server automatically.

Please read Contributing.md for contributing standards and more IMPORTANT information.

Clone this wiki locally