This document outlines the steps required to configure routing and domain mappings when deploying a new whitelabel partner container (such as
markup
).bt-checkout.aipowerpay.comWhy This Configuration is Necessary#
BasaltSurge handles two types of domains:
- Main Domains: The core platform domains (e.g., markup) and Partner Container Domains (e.g.,
basaltsurge.iomarkup). These domains serve the platform checkout, admin console, portal pages, and developer dashboards.bt-checkout.aipowerpay.com - Custom Merchant Domains: Vanity domains pointing to individual merchant stores (e.g., markup).
my-bakery.com
If a new partner container domain is deployed without updating the platform's routing system, the proxy middleware will mistake it for a Custom Merchant Domain. It will rewrite the home page
markup
to /markup
, which triggers a database lookup, fails to find a matching shop config, and throws a 404 Page Not Found error./shop/your-domain.comSetup Steps for a New Partner Container#
When onboarding a new partner container (e.g., brand key:
markup
, domain: newpartnermarkup
), you must adjust three areas: Global Main Domain Checks, Branding Hostname Mappings, and Internal Container Routing.checkout.newpartner.com1. Register the Domain as a Main Domain#
Add the partner domain suffix (and any fallback domains) to
markup
in routing.ts. This prevents the proxy/middleware from triggering custom shop rewrites.isMainDomainHostModify the return block of
markup
in src/lib/routing.ts:isMainDomainHosttypescriptexport function isMainDomainHost(host: string): boolean { // ... (private IP / localhost checks) return ( h.endsWith("basalthq.com") || h.endsWith("basaltsurge.io") || h.endsWith("aipowerpay.com") || // Existing partner h.endsWith("newpartner.com") || // <--- ADD NEW PARTNER DOMAIN h.includes("azurewebsites.net") || h.includes("azurecontainerapps.io") || h.includes("vercel.app") // ... ); }
2. Configure Dynamic Brand Key Resolution#
To ensure server rendering, layout rendering, and client-side components automatically map the hostname to the correct
markup
(even if environment variables are missing or dynamic), update the static brand patterns and custom domain dictionaries.brandKeyYou must keep these mappings in sync across the following three files:
A. Add the Brand Key to markupKNOWN_PARTNER_PATTERNS
#
KNOWN_PARTNER_PATTERNSAdd your brand key to the prefix mapping:
typescriptconst KNOWN_PARTNER_PATTERNS: Record<string, string> = { paynex: "paynex", xoinpay: "xoinpay", newpartner: "newpartner", // <--- ADD NEW BRAND KEY };
B. Add the Hostname to markupKNOWN_PARTNER_DOMAINS
#
KNOWN_PARTNER_DOMAINSAdd the full subdomains/domains to the custom domains registry:
typescriptconst KNOWN_PARTNER_DOMAINS: Record<string, string> = { "paynex.azurewebsites.net": "paynex", "checkout.newpartner.com": "newpartner", // <--- ADD DYNAMIC RESOLUTION "www.checkout.newpartner.com": "newpartner", // <--- ADD WWW VARIANT };
Verification & Deployment Runbook#
After making the code changes, verify the configuration:
- Deploy the container with the environment variable overrides:
env
CONTAINER_TYPE=partner BRAND_KEY=newpartner - Test the Homepage via curl: Ensure requests to the home page return the landing/checkout structure with markupand the correct partner brand values, rather than returning Next.js 404 HTML:
data-pp-container-type="partner"bashcurl -I "https://checkout.newpartner.com/" - Validate System Paths: Test that markup,
/adminmarkup,/portalmarkupresolve correctly and apply the appropriate security headers./api/site/container