<aside> 🔁 Synced from GitHub #75f83f6c21ba. Edit in the paidhr-system-docs repository, not here: changes made in Notion are overwritten.

</aside>

White-label & partners

Status: Live

In one paragraph

PaidHR can run under another company's brand. A reseller or partner is an agent: it has its own name, logo, colour, sender email and domain. Every customer organisation belongs to one agent (PaidHR itself is the default). When someone opens the web app on a partner's domain, the app fetches that domain's branding and shows the partner's logo, colours and wording. Emails, links and survey and approval pages use the partner's domain. Partners manage their brand and see their clients in the partner portal (customization-app), and can open a client's account through delegated access.

The parts

flowchart LR
  subgraph Membership["core-backend · membership"]
    AG["Agents<br/>name, alias, UniqueId, Domain,<br/>SenderEmail, LogoUrl, Color, Address"]
    ORG["Organisations<br/>AgentId → agent"]
  end
  subgraph EWA["ewa-service · MongoDB"]
    INT["Integration<br/>domain, agentId, country, senderEmail,<br/>customization (theme, pages)"]
    DUR["Domain update requests"]
  end
  PORTAL["Partner portal<br/>customization-app"] -->|"/v1/integration/*"| INT
  PORTAL -->|"Whitelabel/Agents/*"| AG
  WEB["Web app on partner.domain"] -->|"GET /v1/integration/{hostname}"| INT
  ORG --> AG
  INT -. agentId .-> AG
  CORE["core-backend emails"] -->|"agent name, domain, logo"| MAIL[Branded email]
Piece Lives in What it holds
Agent membership Agents The brand: name, alias, UniqueId, domain, sender email, logo, colour, address
Organisation → agent membership Organisations.AgentId Which brand a customer belongs to
Integration ewa-service MongoDB The partner's web settings, keyed by domain: name, agentId, country, sender email, and a customization object (theme, colours, logo, page content). Partners also have their own portal logins (IntegrationUser)
Domain update request ewa-service MongoDB A partner asking to change their domain or subdomain; approved or declined by PaidHR

How the web app brands itself

  1. On load, AppEntryPoint.tsx reads window.location.hostname and calls GET {REACT_APP_EWA_BASE_URL}/v1/integration/{hostname}.
  2. The response's customization goes into the customization-settings store, cached in local storage.
  3. Logos, colours and page wording come from that store. On PaidHR's own domains (isPadeDomain()), the PaidHR defaults are used and the fetch is skipped.
  4. While the branding is loading, the app can't draw branded chrome, so it waits rather than flashing PaidHR's logo on a partner's domain.

How emails and links are branded

Every EmailService.Send… call takes the organisation's agent name, alias, domain and logo. So:

Because production links use the customer's own domain while dev uses a shared Azure host, email deliverability is worst on dev.

The partner portal (customization-app)

A Vite + React app for partners. It calls ewa-service for its own sign-in and settings, and core-backend for client data.