Spoke Domain & Path Routing
middleware-driven multi-domain project resolution
Published: 2026-06-26 | Project: Software as Glass Monorepo | Discipline: Sovereign Architecture & Systems Design
Author: Nicholas Alexander MacAskill — Founder & CTO, Flocano Labs | Canonical: https://www.nicholasmacaskill.com/dossier/sag-spoke-domain-routing
One Deploy, Many Sovereign Front Doors
The monorepo serves Nicholas MacAskill, Flocano Labs, Memoirs, and five artifact spoke domains from a single Next.js app. middleware.ts resolves which project layer is active on every request by combining hostname and pathname — without forking the codebase per brand.
Resolution Rules
1. Path wins for layers: /memoirs, /nicholasmacaskill, and /flocanolabs always set the active project, regardless of host. 2. Spoke hosts stay portal-themed on /: glassmetric.com, betbodhi.com, verithra.com, bayesianpivot.com, and engineeringofmomentum.com only switch to Flocano theme inside /flocanolabs/* routes. 3. Headers bridge SSR → client: Injected x-active-project and x-url-pathname let layout.tsx pick the correct theme class on first paint and keep GlobalBottomNav in sync after client navigations.
const spokeSubdomains = [
"glassmetric.com",
"betbodhi.com",
"verithra.com",
"bayesianpivot.com",
"engineeringofmomentum.com",
];
if (pathname.startsWith("/memoirs")) activeProject = "memoirs";
else if (pathname.startsWith("/nicholasmacaskill")) activeProject = "nicholasmacaskill";
else if (cleanHost.includes("flocanolabs") || pathname.startsWith("/flocanolabs")) {
activeProject = "flocanolabs";
} else if (spokeSubdomains.includes(cleanHost) && pathname.startsWith("/flocanolabs")) {
activeProject = "flocanolabs";
}
requestHeaders.set("x-active-project", activeProject);
requestHeaders.set("x-url-pathname", pathname);Redirect Guard
glassmetricos.com 301s to www.glassmetric.com preserving path and query — preventing split SEO equity across typo domains.