Skip to main content

Run Local Dev

Description

Front end requires Web API connection to properly function.

Developer can point front end code to remote deployed API or run Web API Locally.

With Local Backend

Local .env

To run Web APIs locally, ensure presence of .env file in web-api folder.
Ask any developer, or product manager to provide all environmental variables for .env file.

Web APIs

3 Apis must be launched.

  • web-admin-api
  • web-client-api
  • web-media-api

In 3 separate terminal windows Navigate to each API directory:

cd <project_directory>/web-api/web-admin-api
cd <project_directory>/web-api/web-client-api
cd <project_directory>/web-api/web-media-api

Start scrips for each (also can be found in package.json):

npm run start:web-admin-api
npm run start:web-client-api
npm run start:web-media-api

With Remote Backend

There’s an option to launch only front end locally, and point it to remote backend APIs.
To do that, developer must manually replace “localhost” variables in next.config.js with URL values from deploy.sh.
After deployment, next.config.js variables will be replaced back to localhost original values.
This manual URL replacement must be done every time.

Front end Web

/front/front-web/next.config.js /front/front-web/deploy.sh

Change localhost variables:

  1. ADMIN_API_URL: "http://localhost:3000",
  2. MEDIA_API_URL: "http://localhost:3003",
  3. CLIENT_API_URL: "http://localhost:3001",

To deployment URLs:

  1. back_dev_url="https://dav6st0rw3.execute-api.us-east-1.amazonaws.com/dev"
  2. media_dev_url="https://gk8nj9pvi8.execute-api.us-east-1.amazonaws.com/dev"
  3. client_dev_url="https://uey7agwpr2.execute-api.us-east-1.amazonaws.com/dev"

Front end Admin

/front/front-admin/next.config.js /front/front-admin/deploy.sh

Change localhost variables:

  1. CLIENT_API_URL: "http://localhost:3001",

To deployment URLs:

  1. client_dev_url="https://uey7agwpr2.execute-api.us-east-1.amazonaws.com/dev"

Run Local Frontend

Launching Local Front end is the same no matter if remote or local Backend is used.

There are 2 Front ends.

  • front-web
  • front-admin

Open 2 terminal windows.

Navigate into each front end directory:

cd <project_directory>/front/front-web
cd <project_directory>/front/front-admin

Start front end for each:

npm run dev