Full Setup

For more information about the details of each component, refer to each individual page:

This guide only contains the preliminary steps to get the WebApp running locally. Further configuration like Discord support etc. are not covered here.

Prerequisites

Ensure the following prerequisites are installed first:

Additionally, setup Firebase as instructed in the developer guide.

Steps

First, we have to setup the database first.

  1. Create a database locally with <name>
  2. Clone the backend repository

     git clone https://github.com/nushackers/hnr-api.git
    
  3. Change to project directory

     cd hnr-api/
    
  4. Migrate the database to create all tables

     DATABASE_URL=postgres://postgres:root@localhost:5432/<name> dotnet ef database update
    

Then, setup the backend.

  1. Create .env with the following minimal variables:

     DATABASE_URL=postgres://postgres:root@localhost:5432/<name>
     # Project name when setting up Firebase
     FIREBASE_PROJECT_ID=
    
  2. Load .env to the terminal

     export $(cat .env | xargs)
    
  3. Edit the launchSettings.json’s DATABASE_URL field to have the same value as the one supplied in the .env file

  4. Start the backend

     dotnet run
    

The backend will run on localhost:5134 by default. To change this, modify the launchSettings.json file under the applicationUrl property.

Finally, setup the frontend.

  1. Return to home directory

     cd ../
    
  2. Clone the frontend repository

     git clone https://github.com/nushackers/hnr-frontend.git
    
  3. Change to project directory

     cd hnr-frontend/
    
  4. Install dependencies

     yarn install
    
  5. Setup .env with relevant details, refer to this section for the fields needed

    The key fields needed will be NEXT_PUBLIC_FIREBASE_API_KEY, NEXT_PUBLIC_FIREBASE_PROJECT_ID, and NEXT_PUBLIC_FIREBASE_APP_ID

    The values of NEXT_PUBLIC_API_URL and NEXT_PUBLIC_FLAGS_URL should both be blank as well.

  6. Start the frontend

     yarn dev
    

    yarn dev must be used to set NODE_ENV to development. Otherwise, the frontend will try using production values instead.

Lastly, validate the setup by visiting localhost:3000/register and attempting to create a new account. If all goes well, you should be able to view the newly created account in Firebase and a new database entry should be found under the "Users" table of the database after you fill in your details for setting up.