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
passwordis enabled forGrantsunder 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-AuthenticationtoDefault 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.jsonfile toconfig.json. - If the
envvariable 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 asenvwill result in api-gateway usinglocalhostfor each services. - The
appOriginvariable should point to where your frontend is running. Default value ishttp://localhost:3000 - Using the Auth0 Application created, enter the
domain,clientIdandaudiencerespectively into theconfig.jsonfile.- The
audienceshould be the API URL toAuth0 Management API.
- The
- Rename
config-sample.jsonfile toconfig.json. - Using the same Auth0 Application created for API gateway, enter the
domain,clientIdandaudiencerespectively into theconfig.jsonfile.- The
audienceshould be the API URL toAuth0 Management API.
- The
- Rename
.env-samplefile to.env. - The
APP_ORIGINvariable 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_PORTandREDIS_REMOTE_PASSWORDrespectively into the.envfile.
- Rename
config-sample.jsonfile toconfig.json. - Using the Auth0 Application created, enter the
domain,clientIdandaudiencerespectively into theconfig.jsonfile.- The
audienceshould be the API URL toAuth0 Management API.
- The
- Rename
.env-samplefile to.env. - If the
ENVvariable isPROD, the question service will read the config file for the URL of the MongoDB. Anything else asenvwill result in question service using the mongodb running atlocalhost. - Using the MongoDB connection you created, enter the connection string as
DB_CLOUD_URIin.envfile. - Using the Redis Stack you created, enter the
REDIS_REMOTE_HOST,REDIS_REMOTE_PORTandREDIS_REMOTE_PASSWORDrespectively into the.envfile.
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.jsonfile toconfig.json. - Using the Auth0 Application created, enter the
domain,clientIdandaudiencerespectively into theconfig.jsonfile. - The
API_URLvariable should point to where your backend is running. Default value ishttp://localhost:3001 - Rename
.env-samplefile to.env. - Using the Auth0 Application created, enter the
CLIENT_SECRETinto the.envfile. - Create your own user in Auth0 (Auth0 -> user management -> create user)
- Using the user you created in Auth0, enter the
USER_NAMEandPASSWORDrespectively into the.envfile. - Run service using
node populateQuestions.jsand wait about 1 minute. Upon successful you should see a log message similar to the one below:
- Rename
config-sample.jsonfile toconfig.json. - The
API_URLvariable 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,clientIdandaudiencerespectively into theconfig.jsonfile.- The
audienceshould be the API URL toAuth0 Management API.
- The
- Install npm packages using
npm i. - Run Frontend using
npm start.
