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:
-
Entity framework CLI
dotnet tool install --global dotnet-ef
Additionally, setup Firebase as instructed in the developer guide.
Steps
First, we have to setup the database first.
- Create a database locally with
<name>
-
Clone the backend repository
git clone https://github.com/nushackers/hnr-api.git
-
Change to project directory
cd hnr-api/
-
Migrate the database to create all tables
DATABASE_URL=postgres://postgres:root@localhost:5432/<name> dotnet ef database update
Then, setup the backend.
-
Create
.env
with the following minimal variables:DATABASE_URL=postgres://postgres:root@localhost:5432/<name> # Project name when setting up Firebase FIREBASE_PROJECT_ID=
-
Load
.env
to the terminalexport $(cat .env | xargs)
-
Edit the
launchSettings.json
’sDATABASE_URL
field to have the same value as the one supplied in the.env
file -
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.
-
Return to home directory
cd ../
-
Clone the frontend repository
git clone https://github.com/nushackers/hnr-frontend.git
-
Change to project directory
cd hnr-frontend/
-
Install dependencies
yarn install
-
Setup
.env
with relevant details, refer to this section for the fields neededThe key fields needed will be
NEXT_PUBLIC_FIREBASE_API_KEY
,NEXT_PUBLIC_FIREBASE_PROJECT_ID
, andNEXT_PUBLIC_FIREBASE_APP_ID
The values of
NEXT_PUBLIC_API_URL
andNEXT_PUBLIC_FLAGS_URL
should both be blank as well. -
Start the frontend
yarn dev
yarn dev
must be used to setNODE_ENV
todevelopment
. 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.