Core Concepts

Concept Description
Region A named, independently deployable instance of the full Velaris stack (all 6 services) in a specific geographic cluster. Each region has its own PostgreSQL 16 database, Valkey 8, and service endpoints. Registered in Studio > HxGlobal > Regions.
Data Residency Policy A rule that pins one or more case types to a specific region. Cases of a pinned type may only be created, read, and mutated within that region. Policies are enforced at the API gateway layer — requests that would violate residency are rejected before they reach the database.
X-Velaris-Region Header An HTTP request header sent by the Velaris frontend (or API clients) declaring the user's home region. Format: X-Velaris-Region: eu-west-1. The API gateway uses this header to route requests to the correct regional stack. Frontend sets this based on the authenticated user's home_region claim in the JWT.
Cross-Region Read A read operation on a case whose data residency policy pins it to a different region than the requestor's home region. Cross-region reads must be explicitly granted at the access group level. They are always audit-logged with source region, target region, requesting user, and timestamp. Cross-region writes are never permitted.
Tenant Isolation Even within a shared regional cluster, each tenant (organisation) is namespace-isolated at the database level using PostgreSQL row-level security and separate schema prefixes. One tenant cannot access another's data regardless of region configuration.
HTTP 451 The response code returned when a request is blocked due to a data residency violation. Includes a Reason header naming the violated policy and the case type slug. The requesting client should not retry the same request against the same region — the violation is deterministic.

How to Configure Multi-Region Deployment

  1. Deploy a full Velaris stack in each target region. Each regional deployment requires the full stack (Studio :5173, the API gateway :8200, the case-service monolith on loopback :8201, the flow engine :8100, and the Temporal worker). Each region has its own dedicated PostgreSQL 16 instance and Valkey 8 instance — databases are not shared across regions. Run the standard Velaris database migrations in each region independently — start-velaris.sh applies them, and each region keeps its own schema_migrations ledger.

  2. Register each region in Studio. On the primary (hub) region's Studio, navigate to Studio > HxGlobal > Regions > Add Region. Fill in the region registration form (see field reference table below). Regions become visible to all other regions after registration via the cross-region registry sync, which runs every 60 seconds.

  3. Define residency policies. Navigate to Studio > HxGlobal > Residency Policies > Add Policy. Select the target region and the case types to pin to it. A case type can be pinned to exactly one region. Once a policy is active, any attempt to create a case of the pinned type from a different region returns HTTP 451.

  4. Configure the frontend to send X-Velaris-Region. In your frontend environment configuration (VITE_DEFAULT_REGION), set the default region. For user-specific routing, ensure your auth provider includes a home_region claim in the JWT payload (e.g., "home_region": "eu-west-1"). The Velaris frontend reads this claim and sets the X-Velaris-Region header on every API request automatically.

  5. Grant cross-region read access (if needed). Navigate to Studio > Access Groups > [Group] > Permissions > Cross-Region Reads. Select the source region and the specific case types that members of this group may read across regions. This grant applies to reads only — writes always occur in the case's home region.

  6. Test residency enforcement. From a user with a non-matching home region, attempt to access a case of a pinned type. Confirm the API returns HTTP 451 with the expected Reason header. Confirm the audit log records the violation attempt under Studio > Audit Log > Residency Events.

Region Registration Fields

Field Required Description
Region ID Yes Unique slug identifier. Used in the X-Velaris-Region header and JWT home_region claim. Convention: [cloud]-[area]-[number], e.g., eu-west-1, ap-southeast-1, us-east-2. Cannot be changed after registration.
Display Name Yes Human-readable region name shown in Studio, audit logs, and the HxGlobal dashboard. Example: "EU West (Ireland)", "Asia Pacific (Singapore)".
API Base URL Yes The publicly reachable base URL for this region's case-service. Other regions use this URL to validate cross-region read grants. Example: https://eu.your-velaris-instance.com
Geographic Label Yes Free-text geographic description used in residency policy descriptions and compliance reports. Example: "European Union (GDPR jurisdiction)", "United Kingdom (UK GDPR)".
Admin Contact Yes Email address of the regional administrator. Receives alerts for residency violation spikes, health check failures, and cross-region registry sync errors.
Residency Policies No List of case type slugs pinned to this region. Can also be configured separately under Residency Policies. Changes take effect within 60 seconds across all connected regions.
Health Check URL No Optional HTTP endpoint polled every 30s by the hub region to confirm the regional stack is reachable. Defaults to {API Base URL}/health. A failing health check triggers an alert and marks the region as degraded in the HxGlobal dashboard.
Sync Interval (s) No How often this region's registry entry is refreshed across the network. Default: 60. Lower values increase cross-region consistency but add HTTP polling load.

Data Residency Violation — HTTP 451

When a request is blocked by a data residency policy, the API gateway returns:

HTTP/1.1 451 Unavailable For Legal Reasons
Content-Type: application/json
X-Velaris-Residency-Policy: eu-gdpr-mortgage
X-Velaris-Pinned-Region: eu-west-1
X-Velaris-Requestor-Region: us-east-1

{
  "error": "data_residency_violation",
  "policy": "eu-gdpr-mortgage",
  "case_type": "mortgage-application",
  "pinned_region": "eu-west-1",
  "message": "This case type is pinned to the eu-west-1 region by the eu-gdpr-mortgage residency policy. Redirect your request to the eu-west-1 API endpoint."
}

The response body includes enough information for the client or API gateway to automatically redirect the request to the correct regional endpoint. This enables transparent region-aware proxies that retry violations against the correct region without user intervention.

Cross-Region Reads

Cross-region reads are permitted when all three conditions are met:

Cross-region reads are always audit-logged. Every permitted cross-region read generates an entry in the audit log with: requesting user, requesting region, target region, target case type, case reference(s) read, timestamp, and the access group grant that permitted it. There is no way to suppress this logging — it is enforced at the infrastructure layer, not the application layer. Audit records are stored in both the requestor's regional database and the target region's database for redundancy.

Tenant Isolation

Within a shared regional cluster (where multiple organisations share the same Velaris deployment), tenant isolation is enforced at two levels:

HxGlobal Dashboard

The Studio > HxGlobal dashboard provides a real-time view of all registered regions: