Skip to main content

Overview

The FAD SDK supports multiple environments to separate testing and production workloads. Use the getFadEnvironments() method to retrieve available environment values.

getFadEnvironments()

Static method that returns an object containing all available SDK environments.
static getFadEnvironments(): FadEnvironment

Return Value

Returns an object with environment constants:
UATHA
number
default:"2"
Test/development environment for safe testing without affecting production data
PROD
number
default:"3"
Production environment for live applications

Usage

Basic Environment Configuration

import FadSDK from '@fad-producto/fad-sdk';

const TOKEN = 'your-fad-sdk-token';

// Get available environments
const environments = FadSDK.getFadEnvironments();
console.log(environments);
// Output: { UATHA: 2, PROD: 3 }

// Initialize with UATHA (test) environment
const options = {
  environment: FadSDK.getFadEnvironments().UATHA
};

const FAD_SDK = new FadSDK(TOKEN, options);

Environment Selection

Use the UATHA environment for development and testing.
const options = {
  environment: FadSDK.getFadEnvironments().UATHA
};

const FAD_SDK = new FadSDK(TOKEN, options);
When to use UATHA:
  • Development and testing
  • Integration testing
  • QA validation
  • Demos and proof of concepts
  • Training and onboarding

Environment Values

UATHA

UATHA
number
default:"2"
The test/development environment.Characteristics:
  • Safe for testing and development
  • Isolated from production data
  • May have different rate limits
  • Used for integration testing
Base URL: Points to FAD’s testing infrastructure
Example:
import FadSDK from '@fad-producto/fad-sdk';

const FAD_SDK = new FadSDK(TOKEN, {
  environment: FadSDK.getFadEnvironments().UATHA
});

try {
  const response = await FAD_SDK.startRegula(
    credentials,
    FadSDK.Constants.Regula.CaptureType.DOCUMENT_READER,
    true,
    true,
    configuration
  );
  console.log('Test response:', response);
} finally {
  FAD_SDK.end();
}

PROD

PROD
number
default:"3"
The production environment.Characteristics:
  • Live production infrastructure
  • Real user data processing
  • Production rate limits and quotas
  • Subject to SLA guarantees
Base URL: Points to FAD’s production infrastructure
Example:
import FadSDK from '@fad-producto/fad-sdk';

const FAD_SDK = new FadSDK(TOKEN, {
  environment: FadSDK.getFadEnvironments().PROD
});

try {
  const response = await FAD_SDK.startFacetec(
    credentials,
    configuration
  );
  console.log('Production response:', response);
} finally {
  FAD_SDK.end();
}

Environment-Based Configuration

Dynamic Environment Selection

import FadSDK from '@fad-producto/fad-sdk';

// Determine environment based on your app's configuration
const isProduction = process.env.NODE_ENV === 'production';

const options = {
  environment: isProduction 
    ? FadSDK.getFadEnvironments().PROD 
    : FadSDK.getFadEnvironments().UATHA
};

const FAD_SDK = new FadSDK(TOKEN, options);
console.log(`SDK initialized in ${isProduction ? 'PROD' : 'UATHA'} mode`);

Environment Configuration Object

import FadSDK from '@fad-producto/fad-sdk';

const CONFIG = {
  development: {
    environment: FadSDK.getFadEnvironments().UATHA,
    debug: true,
    verbose: true
  },
  staging: {
    environment: FadSDK.getFadEnvironments().UATHA,
    debug: true,
    verbose: false
  },
  production: {
    environment: FadSDK.getFadEnvironments().PROD,
    debug: false,
    verbose: false
  }
};

const currentEnv = process.env.APP_ENV || 'development';
const config = CONFIG[currentEnv];

const FAD_SDK = new FadSDK(TOKEN, config);

Custom Base URLs

You can override the default environment URLs by providing a custom baseUrl in the options:
import FadSDK from '@fad-producto/fad-sdk';

const options = {
  environment: FadSDK.getFadEnvironments().PROD,
  
  // Override with custom URLs
  baseUrl: {
    iframeUrl: 'https://custom-iframe.yourdomain.com',
    fadWebUrl: 'https://custom-web.yourdomain.com',
    biometricsByStepsUrl: 'https://custom-biometrics.yourdomain.com'
  }
};

const FAD_SDK = new FadSDK(TOKEN, options);
Custom base URLs override the default environment URLs. Ensure your custom URLs point to valid FAD SDK endpoints.

Best Practices

Before deploying any changes to production, thoroughly test all functionality in the UATHA environment.
// Development/Staging
const devOptions = {
  environment: FadSDK.getFadEnvironments().UATHA
};

// Only after successful testing
const prodOptions = {
  environment: FadSDK.getFadEnvironments().PROD
};
Store environment configuration in environment variables rather than hardcoding.
// .env.development
FAD_ENVIRONMENT=UATHA
FAD_TOKEN=dev-token

// .env.production
FAD_ENVIRONMENT=PROD
FAD_TOKEN=prod-token
// Application code
const envMap = {
  'UATHA': FadSDK.getFadEnvironments().UATHA,
  'PROD': FadSDK.getFadEnvironments().PROD
};

const options = {
  environment: envMap[process.env.FAD_ENVIRONMENT] || FadSDK.getFadEnvironments().UATHA
};

const FAD_SDK = new FadSDK(process.env.FAD_TOKEN, options);
Use different tokens and credentials for each environment.
const credentials = {
  UATHA: {
    token: process.env.FAD_TOKEN_UATHA,
    license: process.env.LICENSE_KEY_UATHA
  },
  PROD: {
    token: process.env.FAD_TOKEN_PROD,
    license: process.env.LICENSE_KEY_PROD
  }
};

const env = process.env.NODE_ENV === 'production' ? 'PROD' : 'UATHA';
const config = credentials[env];

const FAD_SDK = new FadSDK(config.token, {
  environment: FadSDK.getFadEnvironments()[env]
});
Log which environment is being used to help with debugging and monitoring.
const environments = FadSDK.getFadEnvironments();
const selectedEnv = environments.PROD;

console.log('FAD SDK Initialization:', {
  environment: selectedEnv === environments.PROD ? 'PROD' : 'UATHA',
  version: FadSDK.version,
  timestamp: new Date().toISOString()
});

const FAD_SDK = new FadSDK(TOKEN, {
  environment: selectedEnv
});

Environment Comparison

FeatureUATHA (Test)PROD (Production)
PurposeDevelopment & TestingLive Production
DataTest/Mock DataReal User Data
Rate LimitsGenerous for testingProduction quotas
SLABest effortGuaranteed uptime
MonitoringBasicFull monitoring & alerts
CostFree/ReducedProduction pricing

Default Environment

If no environment is specified in the options, the SDK defaults to UATHA (test environment).
// These are equivalent:
const FAD_SDK_1 = new FadSDK(TOKEN);

const FAD_SDK_2 = new FadSDK(TOKEN, {
  environment: FadSDK.getFadEnvironments().UATHA
});

Troubleshooting

Verify your environment configuration:
const environments = FadSDK.getFadEnvironments();
console.log('Available environments:', environments);

const options = {
  environment: FadSDK.getFadEnvironments().PROD
};

console.log('Selected environment:', options.environment);
console.log('Is PROD?', options.environment === environments.PROD);
Ensure you’re using the correct token for the selected environment:
  • UATHA tokens only work in UATHA environment
  • PROD tokens only work in PROD environment
// Check token matches environment
const isProd = options.environment === FadSDK.getFadEnvironments().PROD;
const tokenEnv = TOKEN.includes('prod') ? 'PROD' : 'UATHA';

if (isProd && tokenEnv !== 'PROD') {
  console.warn('Token mismatch: Using UATHA token in PROD environment');
}

Next Steps

Constructor

Learn more about SDK initialization

Constants

Explore SDK constants and values

FadSDK Class

View all available methods

Build docs developers (and LLMs) love