Skip to content

Multi-Region Design ​

PPP holds sensitive medical data — surgical logbooks, CPD records, wellness assessments, 360 reviews — for doctors in multiple jurisdictions. UK data-protection law and Australian privacy law both pull us towards data sovereignty: UK doctor data stays in the UK, Australian doctor data stays in Australia, and there is no cross-border replication.

This page documents where we are today and where the design is going. For the concrete Azure resources see Azure Infrastructure.

Current State (as of UK launch) ​

PPP is single-region today. Both the ppp-uk-uat and ppp-uk-prod Pulumi stacks deploy to uksouth (Azure UK South — London). There is no Australian Azure deployment, no cross-region replication, and no region-routing layer in front of the API.

What existsWhere
UAT Azure stackapi/infra-azure/Pulumi.ppp-uk-uat.yaml → azure-native:location: uksouth
Production Azure stackapi/infra-azure/Pulumi.ppp-uk-prod.yaml → azure-native:location: uksouth
Cloudflare DNS and PagespppUat and pppProd stacks under api/infra-cloudflare/
AU-region Pulumi stacksNot created
Region-aware routing at the edgeNot configured
Grafana cross-region dashboardNot created

Australian and UK doctors who sign up today both read and write to the same UK South PostgreSQL instance. This is a known, explicit trade-off: the platform is pre-revenue and the compliance obligation for Australian data residency is deferred until there is a live Australian customer base to justify the extra operating cost.

Target Design ​

The target architecture is two fully isolated regional deployments — one in UK South, one in Australia East — fronted by Cloudflare, with no cross-region application traffic and no shared data plane.

Regions ​

RegionAzure regionDoctorsPrimary compliance driver
UKUK South (London)UK-registered (GMC)UK GDPR, ISO 27001, UK G-Cloud
AustraliaAustralia East (Sydney)AU-registered (AHPRA)Australian Privacy Act, IRAP Protected

Both Azure regions hold the ISO 27001 / SOC 2 Type II certifications required by the compliance posture; UK South adds UK G-Cloud and Australia East adds IRAP Protected.

Isolation Model ​

Data sovereignty is enforced at the infrastructure layer, not at the application layer. Each region is a fully independent deployment that shares nothing but the Cloudflare edge in front of it.

  1. Separate Pulumi stacks. A new region is a new pair of stacks (ppp-au-uat, ppp-au-prod) with their own config, their own state, and no stack references crossing regions.
  2. Separate resource groups. Per-environment resource groups named ppp-uk-<env> and ppp-au-<env>.
  3. Separate databases. Each region gets its own PostgreSQL Flexible Server. No replication between them.
  4. Separate storage accounts. Each region gets its own Blob Storage account in Locally Redundant Storage (LRS) — deliberately not geo-redundant — so writes cannot leak cross-region.
  5. Region-locked Container Apps. A Container App in UK South can only reach the UK South database and storage; same for AU East. There is no code path that points at the other region.
  6. No shared secrets. Each Key Vault is region-scoped and each region's secrets rotate independently.

Routing ​

The current thinking is to route at signup, not per-request:

  • The signup flow asks the doctor for their primary registration body (GMC, AHPRA, GMC + AHPRA, other).
  • Registration bodies map 1:1 to regions.
  • After signup the user is redirected to the region-specific subdomain (e.g. au.professionalperformanceportfolio.com), and their session is bound to that region for life.
  • Cloudflare routes each regional subdomain to the matching api-<region>-<env> Container App.

This keeps the routing logic simple and auditable — a user only ever sees one region's data — and avoids the need for a region-aware edge proxy or a global database layer.

Cross-Region Reporting (target) ​

Super-admin dashboards will need a cross-region view (overall adoption, revenue, feature usage) without violating data sovereignty. The design calls for Grafana Cloud with strictly anonymized data. Neither the Grafana stack nor the grafana_* views exist today — this section describes the intended approach when the AU region lands:

  1. Anonymized database views. Each regional database exposes grafana_* views containing only aggregates — counts, sums, durations, week/month buckets. Zero PII and no row-level data.
  2. Read-only Postgres user. Each region has a grafana_reader role with SELECT on grafana_* only.
  3. Direct regional datasources. Grafana Cloud connects to each regional database over TLS and queries the anonymized views directly — no ETL, no aggregation outside the region.
  4. Side-by-side panels. The ppp-metrics dashboard renders UK and AU data in parallel panels so the super admin can see both regions at a glance without either region's rows ever mixing.

Example anonymized view shape (the real DDL lives with the migrations):

sql
CREATE VIEW grafana_adoption_metrics AS
SELECT
  date_trunc('month', created_at) AS month,
  country_code,
  COUNT(*) AS new_users,
  COUNT(*) FILTER (WHERE account_type = 'cpd') AS cpd_subscribers,
  COUNT(*) FILTER (WHERE account_type = 'ppp') AS ppp_subscribers
FROM ppp_user
GROUP BY 1, 2;

Every new analytics dashboard has to land as a grafana_* view in both regional databases before it can be wired into Grafana — this keeps the "no PII crosses regions" rule enforceable in code review.

Migration Sequence ​

When there is a business case for the Australian region, the rollout will be staged so the UK deployment is never at risk:

  1. Stack scaffolding. New ppp-au-uat / ppp-au-prod stack configs under api/infra-azure/, parameterised off the existing UK stacks.
  2. AU UAT provision. pulumi up against ppp-au-uat — Container App, PostgreSQL, Blob, Key Vault, Managed Identity, Log Analytics, ACS (Australia data location).
  3. AU routing. New Cloudflare DNS records and Pages bindings for the au. subdomain; region-selection UI on the signup page; region-bound sessions in Better Auth.
  4. AU Prod provision. pulumi up against ppp-au-prod, followed by end-to-end smoke tests in region.
  5. Grafana cross-region dashboards. Add the AU PostgreSQL datasource to the Grafana stack, create the ppp-metrics panels, and verify zero PII.
  6. Onboard AU doctors. Marketing to AHPRA-registered doctors, supported by the new regional onboarding flow.

The application code is already country-agnostic — no country-specific SQL, no hard-coded region strings, no tenancy assumptions in the service layer. The primary unknown is the regulatory sign-off (IRAP Protected, Australian Privacy Act attestations) that has to run alongside the technical work.

Why Not Geo-Replicated PostgreSQL? ​

Two reasons:

  1. Data sovereignty. Azure's geo-redundant PostgreSQL replicates across Azure geographies (e.g. UK South → UK West). Cross-region replication between UK and AU would push UK patient data through an AU region (or vice versa) at least transiently — that's the exact thing the sovereignty model is built to prevent.
  2. Cost and operational complexity. Cross-region replication doubles the database footprint and introduces lag that user-facing queries would have to work around. For a pre-revenue platform with a clean signup-routed model, two fully independent databases are simpler, cheaper, and legally defensible.

Internal documentation — org members only