Skip to content

Environment Variables

This document lists all environment variables used by the BidScript backend application. These variables control configuration settings and must be properly set for the application to function correctly.

Core Configuration

  • PORT: The port on which the application server listens (default: 3000)
  • NODE_ENV: Environment mode (development, production, test)
  • HOST: The host address for the application
  • API_PREFIX: Prefix for all API routes (default: /api)
  • LOG_LEVEL: Logging verbosity level (error, warn, info, verbose, debug)

Authentication

  • JWT_SECRET: Secret key used for JWT token signing
  • JWT_EXPIRATION: JWT token expiration time (e.g., 8h, 1d)
  • REFRESH_TOKEN_SECRET: Secret for refresh tokens
  • REFRESH_TOKEN_EXPIRATION: Refresh token expiration time

Database Connections

MongoDB

  • MONGODB_URI: MongoDB connection string URI
  • MONGODB_DATABASE: MongoDB database name

SQL Database

  • SQL_SERVER: SQL Server hostname
  • SQL_DATABASE: SQL database name
  • SQL_USER: SQL username
  • SQL_PASSWORD: SQL password
  • SQL_PORT: SQL Server port (default: 1433)

Redis

  • REDIS_HOST: Redis server hostname
  • REDIS_PORT: Redis server port (default: 6379)
  • REDIS_PASSWORD: Redis server password
  • REDIS_DB: Redis database index

Azure Services

Azure Blob Storage

  • AZURE_STORAGE_CONNECTION_STRING: Azure Storage connection string
  • AZURE_STORAGE_ACCOUNT_NAME: Azure Storage account name
  • AZURE_STORAGE_ACCOUNT_KEY: Azure Storage account access key
  • AZURE_STORAGE_CONTAINER: Azure Blob Storage container name

Azure OpenAI

  • AZURE_OPENAI_API_KEY: Azure OpenAI API key
  • AZURE_OPENAI_ENDPOINT: Azure OpenAI endpoint URL
  • AZURE_OPENAI_API_VERSION: Azure OpenAI API version
  • AZURE_OPENAI_DEPLOYMENT_NAME: Azure OpenAI deployment name

Azure Form Recognizer

  • AZURE_FORM_RECOGNIZER_KEY: Azure Form Recognizer key
  • AZURE_FORM_RECOGNIZER_ENDPOINT: Azure Form Recognizer endpoint URL

Azure Computer Vision

  • AZURE_COMPUTER_VISION_KEY: Azure Computer Vision key
  • AZURE_COMPUTER_VISION_ENDPOINT: Azure Computer Vision endpoint URL

AI Models

Anthropic

  • ANTHROPIC_API_KEY: Anthropic API key for Claude models

LangChain

  • LANGCHAIN_TRACING_V2: Enable LangChain tracing (true, false)
  • LANGCHAIN_ENDPOINT: LangChain API endpoint
  • LANGCHAIN_API_KEY: LangChain API key
  • LANGCHAIN_PROJECT: LangChain project name

Vector Database

  • PINECONE_API_KEY: Pinecone API key
  • PINECONE_ENVIRONMENT: Pinecone environment
  • PINECONE_INDEX: Pinecone index name

Document Processing

  • MAX_DOCUMENT_SIZE: Maximum allowed document size in bytes
  • MAX_CONCURRENT_JOBS: Maximum number of concurrent document processing jobs
  • PARSE_CHUNK_SIZE: Size of chunks for document parsing
  • CHUNK_OVERLAP: Overlap between document chunks

Monitoring and Logging

  • GRAFANA_API_KEY: Grafana API key
  • GRAFANA_URL: Grafana instance URL
  • METRICS_PATH: Path for exposing Prometheus metrics

Security

  • CORS_ORIGINS: Allowed CORS origins (comma-separated list)
  • RATE_LIMIT_WINDOW: Rate limiting window in milliseconds
  • RATE_LIMIT_MAX: Maximum requests per window
  • HELMET_ENABLED: Enable Helmet security middleware (true, false)

WebSockets

  • WS_PORT: WebSocket server port (if different from main port)
  • WS_PATH: WebSocket endpoint path
  • WS_HEARTBEAT_INTERVAL: WebSocket heartbeat interval in milliseconds

Email Notifications

  • SMTP_HOST: SMTP server hostname
  • SMTP_PORT: SMTP server port
  • SMTP_USER: SMTP server username
  • SMTP_PASSWORD: SMTP server password
  • EMAIL_FROM: Sender email address

Example .env File

# Core Configuration
PORT=3000
NODE_ENV=development
API_PREFIX=/api

# Authentication
JWT_SECRET=your-secret-key
JWT_EXPIRATION=8h

# MongoDB Connection
MONGODB_URI=mongodb://localhost:27017
MONGODB_DATABASE=bidscript

# Redis Connection
REDIS_HOST=localhost
REDIS_PORT=6379

# Azure Services
AZURE_STORAGE_CONNECTION_STRING=your-connection-string
AZURE_STORAGE_CONTAINER=documents
AZURE_OPENAI_API_KEY=your-api-key
AZURE_OPENAI_ENDPOINT=https://your-instance.openai.azure.com
AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4

# AI Models
ANTHROPIC_API_KEY=your-api-key

# Vector Database
PINECONE_API_KEY=your-api-key
PINECONE_ENVIRONMENT=us-west1-gcp
PINECONE_INDEX=bidscript-index

# Security
CORS_ORIGINS=http://localhost:3000,https://app.bidscript.co.uk

Setting Environment Variables

In Development

Create a .env file in the root directory of the project with the required variables.

In Production

Configure environment variables according to your deployment platform:

  • Docker: Use environment variables in your docker-compose.yml or Dockerfile
  • Azure: Configure application settings in the Azure Portal
  • Kubernetes: Use ConfigMaps and Secrets to manage environment variables