Environment Variables

This page documents all environment variables and SSM parameters used by the platform.

SSM Parameters (AWS Account 735234196709)

These are stored in AWS Systems Manager Parameter Store in the PhD Advantage client account. Lambda functions read them at runtime.

Parameter Path Type Used By Description
/dissertation-editor/pipedrive/api-token SecureString pipedriveClient API token for authenticating with the Pipedrive REST API
/dissertation-editor/livekit/api-key SecureString tokenGenerator LiveKit server API key for signing JWT tokens
/dissertation-editor/livekit/api-secret SecureString tokenGenerator LiveKit server API secret for signing JWT tokens
/dissertation-editor/livekit/url String tokenGenerator LiveKit server WebSocket URL (e.g., wss://3.93.221.174)

Reading SSM Parameters

Lambda functions use the AWS SDK to read parameters at runtime:

const { SSMClient, GetParameterCommand } = require('@aws-sdk/client-ssm');

const ssm = new SSMClient({});

async function getParameter(name) {
  const response = await ssm.send(new GetParameterCommand({
    Name: name,
    WithDecryption: true,
  }));
  return response.Parameter.Value;
}

Updating SSM Parameters

aws ssm put-parameter \
  --name "/dissertation-editor/pipedrive/api-token" \
  --value "your-new-token" \
  --type SecureString \
  --overwrite \
  --profile dissertation-editor

After updating an SSM parameter, Lambda functions pick up the new value on their next cold start. To force an immediate update, redeploy the affected function.

Backend Environment Variables (Lambda)

These are set in serverless.yml under the provider or individual function configuration. They are injected into Lambda at deploy time.

Variable Value Description
SUBMISSIONS_TABLE submissions-dev DynamoDB table for submission records
CONFIG_TABLE config-dev DynamoDB table for rate schedule and configuration
UPLOAD_BUCKET dissertation-editor-uploads-dev S3 bucket for dissertation uploads
PROCESS_SUBMISSION_FUNCTION dissertation-editor-backend-dev-processSubmission Function name for async invocation
ENABLE_PIPEDRIVE_DEALS true / false Feature flag to enable or disable Pipedrive deal creation

Frontend Environment Variables

These are set in .env.local for local development and in the Amplify Console for deployed environments.

Variable Example Value Description
NEXT_PUBLIC_TOKEN_ENDPOINT https://jwfqmc0638.execute-api.us-east-1.amazonaws.com/token Full URL for the LiveKit token endpoint
NEXT_PUBLIC_API_URL https://jwfqmc0638.execute-api.us-east-1.amazonaws.com Base URL for all backend API calls

Local Development (.env.local)

Create this file in platform/frontend/:

NEXT_PUBLIC_TOKEN_ENDPOINT=https://jwfqmc0638.execute-api.us-east-1.amazonaws.com/token
NEXT_PUBLIC_API_URL=https://jwfqmc0638.execute-api.us-east-1.amazonaws.com

Amplify Environment Variables

For deployed environments, set these in the Amplify Console:

  1. Go to Amplify Console in the PhD Advantage account.
  2. Navigate to Hosting > Environment variables.
  3. Add or update the variables listed above.
  4. Trigger a redeploy for changes to take effect.

Note: NEXT_PUBLIC_ prefixed variables are exposed to the browser at build time. Do not put secrets in NEXT_PUBLIC_ variables.