Access our deployed application here!
To setup our application locally, please follow the instructions below:
- Install Docker Desktop
- Create an Auth0 account
- Create an Auth0 Application (Single Page Application (SPA))
- Ensure you add the URL of the frontend (default value http://localhost:3000) to the following:
- Allowed Callback URLs
- Allowed Logout URLs
- Allowed Web Origins
- Allowed Origins (CORS)
- Under Advanced Settings for the application, ensure that
password
is enabled forGrants
under theGrant Types
- Next, go to Auth0 settings (settings on the left navigation) and under the general tab, scroll down to
API Authorization Settings
. AddUsername-Password-Authentication
toDefault Directory
.
- Ensure you add the URL of the frontend (default value http://localhost:3000) to the following:
- Create an Auth0 Application (Single Page Application (SPA))
- Create a Cloud Atlas account
- Create a MongoDB connection
- Create a Redis Labs account
- Create a Redis Stack
If you would like to use our configurations, please contact us directly.
All our backend services are dockerized and can run using docker compose. However, you will need to configure some .env
and config.json
in order for it to work locally.
- Rename
config-sample.json
file toconfig.json
. - If the
env
variable isPROD
, the api-gateway will read the config file for the URL of each services (The URL in sample file are for docker configuration). Anything else asenv
will result in api-gateway usinglocalhost
for each services. - The
appOrigin
variable should point to where your frontend is running. Default value ishttp://localhost:3000
- Using the Auth0 Application created, enter the
domain
,clientId
andaudience
respectively into theconfig.json
file.- The
audience
should be the API URL toAuth0 Management API
.
- The
- Rename
config-sample.json
file toconfig.json
. - Using the same Auth0 Application created for API gateway, enter the
domain
,clientId
andaudience
respectively into theconfig.json
file.- The
audience
should be the API URL toAuth0 Management API
.
- The
- Rename
.env-sample
file to.env
. - The
APP_ORIGIN
variable should point to where your frontend is running. Default value ishttp://localhost:3000
- Using the Redis Stack you created, enter the
REDIS_REMOTE_HOST
,REDIS_REMOTE_PORT
andREDIS_REMOTE_PASSWORD
respectively into the.env
file.
- Rename
config-sample.json
file toconfig.json
. - Using the Auth0 Application created, enter the
domain
,clientId
andaudience
respectively into theconfig.json
file.- The
audience
should be the API URL toAuth0 Management API
.
- The
- Rename
.env-sample
file to.env
. - If the
ENV
variable isPROD
, the question service will read the config file for the URL of the MongoDB. Anything else asenv
will result in question service using the mongodb running atlocalhost
. - Using the MongoDB connection you created, enter the connection string as
DB_CLOUD_URI
in.env
file. - Using the Redis Stack you created, enter the
REDIS_REMOTE_HOST
,REDIS_REMOTE_PORT
andREDIS_REMOTE_PASSWORD
respectively into the.env
file.
After you configured all the environment and configuration for all the services above, you may go back to the root repo and run:
docker-compose up --build -d
This will bring up the docker containers for the backend.
If you would like to run each services individually, you may go into the service and run:
- Install npm packages using
npm i
. - Run service using
npm start
.
NOTE: Ensure you did not set the env
in config.json
in API gateway to PROD
as that will NOT connect to the services running locally.
- Rename
config-sample.json
file toconfig.json
. - Using the Auth0 Application created, enter the
domain
,clientId
andaudience
respectively into theconfig.json
file. - The
API_URL
variable should point to where your backend is running. Default value ishttp://localhost:3001
- Rename
.env-sample
file to.env
. - Using the Auth0 Application created, enter the
CLIENT_SECRET
into the.env
file. - Create your own user in Auth0 (Auth0 -> user management -> create user)
- Using the user you created in Auth0, enter the
USER_NAME
andPASSWORD
respectively into the.env
file. - Run service using
node populateQuestions.js
and wait about 1 minute. Upon successful you should see a log message similar to the one below:
- Rename
config-sample.json
file toconfig.json
. - The
API_URL
variable should point to where your backend is running. Default value ishttp://localhost:3001
- Using the same Auth0 Application created for API gateway, enter the
domain
,clientId
andaudience
respectively into theconfig.json
file.- The
audience
should be the API URL toAuth0 Management API
.
- The
- Install npm packages using
npm i
. - Run Frontend using
npm start
.