HomeBlogHow to Build a White-Label SaaS...

Engineering Guide · 8 min read · July 14, 2026

How to Build a White-Label SaaS Platform for Multiple Clients

Building a true white-label SaaS platform goes far beyond swapping a logo in the header. Agencies and platform builders need dynamic custom domain SSL routing, server-injected theme tokens, branded email sender authentication, and clean reseller-to-client hierarchy separation.

Author
Smit Desai
Published
July 14, 2026
Read time
8 min read
Topic
SaaS Engineering
Services
Custom Web · Mobile Apps · All Services

Agencies often reach a ceiling with bespoke client builds: you solve the same workflow problem ten times over, yet every new client requires another standalone server, another codebase fork, and another maintenance headache. Turning that repeatable solution into a white-label SaaS platform lets you run one shared codebase while every client experiences it as their own branded software under their own domain.

The catch is that naive "white-labeling" breaks down fast. Swapping a logo in CSS is easy; isolating transactional emails, custom domains with automatic SSL, OAuth callbacks, and reseller billing hierarchies takes deliberate engineering from the first migration.


1. Model the Two-Level vs. Three-Level Hierarchy Early

Before writing domain routing code, decide whether you are selling directly to end clients (two-tier: Platform -> Tenant) or enabling partner agencies to resell to their own customers (three-tier: Platform -> Partner Agency -> End Workspace).

Reseller Schema Structure

CREATE TABLE partners (
    id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    slug VARCHAR(64) UNIQUE NOT NULL,
    brand_name VARCHAR(120) NOT NULL,
    custom_domain VARCHAR(255) UNIQUE,
    theme_config JSONB NOT NULL DEFAULT '{}'::jsonb,
    stripe_account_id VARCHAR(128),
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE TABLE workspaces (
    id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    partner_id BIGINT NOT NULL REFERENCES partners(id),
    name VARCHAR(120) NOT NULL,
    plan_code VARCHAR(64) NOT NULL,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

Separating partners (who own the brand, domain, and commercial relationship) from workspaces (who own operational data) avoids painful schema rewrites when a partner asks to manage 25 sub-clients under one login. For deeper isolation patterns at the database tier, see our multi-tenant SaaS architecture guide.


2. Automate Custom Domains and On-Demand SSL

Nothing kills white-label credibility faster than telling a client to email support so an engineer can manually edit Nginx configs and run Certbot. Provisioning custom domains (portal.clientbrand.com) should be self-service.

Custom Domain Routing Options Compared

Approach Setup Effort Certificate Lifecycle Best Use Case
Caddy On-Demand TLS Low (single Caddyfile + internal ask endpoint) Automatic Let's Encrypt issuance & renewal Self-hosted VPS / container stacks (up to thousands of domains)
Cloudflare for SaaS Medium (API integration + fallback origin) Managed edge SSL + DDoS protection Global edge caching and strict enterprise uptime SLAs
AWS ACM + ALB High (listener cert limits, manual validation) Managed via Route53/CNAME Low domain count with strict AWS-only compliance

Guarding the ask Endpoint

With Caddy, never enable unrestricted on-demand TLS without an authorization callback, or bots can point random domains at your IP and exhaust your ACME rate limits:

{
    on_demand_tls {
        ask https://app.yourplatform.com/internal/domains/verify
    }
}

:443 {
    tls {
        on_demand
    }
    reverse_proxy app:8080
}

Your /internal/domains/verify?domain=portal.clientbrand.com endpoint simply checks whether domain exists and is verified = true in your domains table, returning 200 OK or 404.


3. Inject Dynamic Branding Without Flash of Unstyled Content

A common frontend bug in white-label apps is loading the default platform colors first, fetching /api/brand on mount, and flashing the wrong logo for 300 milliseconds.

Server-Resolved CSS Custom Properties

Resolve the tenant from the Host header on the initial document request and inject CSS variables directly into the HTML shell (or SSR layout) with short-lived edge/Redis caching:

:root {
  --brand-primary: #1d4ed8;
  --brand-primary-contrast: #ffffff;
  --brand-surface: #f8fafc;
  --brand-radius: 0.5rem;
}

Store only constrained design tokens (primary_hex, accent_hex, logo_url, favicon_url, support_email) in theme_config. Avoid letting clients upload raw custom CSS or arbitrary <script> tags—that opens stored XSS vulnerabilities across tenant portals.


4. Eliminate Brand Leaks in Emails, PDFs, and OAuth

White-labeling usually breaks in the places engineers forget to test:

  • Transactional Emails & DKIM: Password resets and invoices sent from noreply@yourplatform.com expose your underlying brand. Give partners a self-serve DNS verification step (CNAME/TXT records via Postmark, Resend, or AWS SES) so emails ship from notifications@clientbrand.com, with a safe fallback like notifications@portal-mail.com on a neutral domain until verified.
  • PDF Invoices & Exports: Pass the resolved partner brand object into every background PDF job—never read global APP_NAME environment variables inside queue workers.
  • Error Pages & Magic Links: Generate password-reset and magic-link URLs using the resolved custom domain (https://portal.clientbrand.com/reset?...), not a hardcoded APP_URL constant.
  • OAuth Redirect URIs: If you offer "Sign in with Google," wildcard redirect URIs are not allowed by most OAuth providers. Route OAuth callbacks through a neutral central auth domain (auth.yourwhiteapp.net/callback) that validates a signed state token and redirects back to the client's custom domain cleanly.

5. Handle Billing: Direct Reseller vs. Platform Pass-Through

Agencies typically monetize white-label platforms in one of two ways:

  1. Wholesale Seat / Flat License: You bill the agency via Stripe Billing based on active client workspaces or seats; the agency bills its clients independently on its own terms.
  2. Stripe Connect Marketplace: End clients pay directly inside the white-label checkout, and funds route to the partner agency's connected Stripe account minus your platform fee.

For most agencies launching their first white-label product, wholesale billing to the partner keeps tax, refunds, disputes, and chargebacks off your plate while letting partners bundle your software into their existing retainers. For an example of cleanly decoupling subscription checkout from product access, see how we implemented web-based subscription workflows for a SaaS platform.


6. Operationalize Client Onboarding in Under 15 Minutes

To make a white-label SaaS profitable, onboarding a new agency or client must be an automated checklist rather than a developer sprint:

  1. Create partner record + default admin user via onboarding form or API.
  2. Provision DNS verification target (cname.yourwhiteapp.net) and poll DNS propagation asynchronously.
  3. Seed default templates, roles, and sample data inside a transactional database job.
  4. Trigger email domain verification and welcome sequence once SSL status flips to active.

Having engineered multi-tenant onboarding flows and managed 300+ WordPress sites at server level for a Finnish partner, automating DNS checks, SSL status polling, and tenant seeding is what turns custom software into a scalable agency asset.


Ship Your White-Label SaaS Platform Cleanly

If your agency is ready to stop rebuilding the same client tools and launch a white-label SaaS platform with automated custom domains, isolated branding, and clean billing, SmitDev can architect and build it with you. Through custom web application development and Launch consulting, we work at $55/day (8–9 hours) or $1,999/month dedicated delivery across 170+ shipped case studies.

Ready to map out your white-label domain and tenant architecture? Tell us what you are building.

Written by Smit Desai · Principal Full-Stack & FDSE

8+ years shipping production systems · 171 case studies · 300+ WordPress servers managed for Finland partners.

Next Steps and Recommended Resources

Next Steps · Recommended Resources

Pillar 1 · Custom Web & SaaS

Custom Web Application Development

Production Laravel, Next.js, API, and multi-tenant SaaS systems engineered end to end at $55/day (8–9 hrs) or $1,999/mo.

Comparison · Buyer Guide

SmitDev vs Software Agencies

See side-by-side economics, senior code ownership, and onboarding speed vs traditional dev shops and marketplaces.

01 — Frequently asked questions

saas engineering

How do white-label SaaS platforms issue SSL certificates automatically for client domains?

Use an on-demand TLS proxy like Caddy or Cloudflare for SaaS. Clients point a CNAME record to your fallback hostname, and your proxy verifies domain ownership against an internal API endpoint before minting a Let's Encrypt certificate on first request.

How do we keep client brands from leaking across white-label portals?

Resolve the tenant solely from the verified Host header in edge middleware, store brand tokens (logo, favicon, palette, email sender) per tenant, and never expose global brand names in password reset emails, OAuth consent screens, or error templates.

Should an agency white-label SaaS use a three-tier hierarchy (Platform -> Agency -> Client)?

Yes, if agencies resell to their own end clients. Model agencies as parent organizations and their customers as child workspaces, allowing billing and branding to inherit from the agency level while data remains isolated at the workspace level.

Can SmitDev build a custom white-label SaaS for our agency?

Yes. We build multi-tenant and white-label SaaS platforms—including custom-domain SSL automation, theme engines, and billing—at $55/day (8–9 hours) or $1,999/month dedicated delivery across 170+ shipped case studies.

03 — Have an engineering need?

hire the right expertise

Let's talk tech.

Deciding between an embedded forward deployed engineer or a senior full stack developer? Share your technical context and timeline.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.