Home > Posts Tenant env

Max Heinritz

Tenant env

The tenant environment is a way to isolate data within a tenant for testing. Some tables like users and roles are always “LIVE”, while other tables like shipments and invoices can be operated against in either “LIVE” or “TEST” environments.

Tenant-owned tables can have a tenant_env column specifying their tenant environment. Each ctx defines its tenantEnv. The tenant environment can be determined by which API key used or by a toggle selection in the user interface. Authorization rules based on ctx limit access to data within one tenant env at a time.

import { Enum, EnumValue } from "@kejistan/enum";

export const TenantEnv = Enum({
  LIVE: "LIVE",
  TEST: "TEST",
});

export type TenantEnv = EnumValue<typeof TenantEnv>;