Diginexus Studio · Enterprise Digital Platforms, Dedicated Developer Pods & Growth Systems · Schedule Technical Discovery →
Technical Whitepaper & System Architecture

The Diginexus Multi-Tenant Platform Architecture

How our edge-rendered Next.js monorepo orchestrates multi-subdomain routing, automated DNS assignment, and isolated PostgreSQL tenant storage.

Multi-Surface Monorepo Routing

Next.js 15 App Router
1. diginexus.io
Marketing Flagship, Agency Portfolio & Case Studies
2. preview.diginexus.io
Watermarked dynamic mockups with LemonSqueezy ClaimBar
3. /admin (Protected)
Operator panel: Scraper, CRM, outreach runner
4. /portal (Client)
Client self-serve dashboard: DNS wizard & CMS

1. Edge Middleware Host Rewrites (`middleware.ts`)

Every incoming HTTP request hits Vercel Edge Middleware before entering the server components tree. The middleware strips port numbers, inspects the hostname header, and rewrites the request internally to the target route group without redirect latency or URL alteration.

// Host Matching if (host.startsWith("preview.")) return NextResponse.rewrite("/preview" + url.pathname); if (host.startsWith("app.")) return NextResponse.rewrite("/portal" + url.pathname); if (isCustomDomain(host)) return NextResponse.rewrite("/custom-domain?host=" + host);

2. PostgreSQL Schema & Row Level Security (RLS)

Data security is enforced directly at the database engine layer via Supabase Row Level Security. Even if an attacker executes arbitrary SQL via the client SDK, the PostgreSQL engine validates `auth.uid() = owner_id`, rendering unauthorized cross-tenant data access mathematically impossible.

CREATE POLICY "Clients can only update own business" ON public.businesses FOR UPDATE USING (auth.uid() = owner_id) WITH CHECK (auth.uid() = owner_id);

3. Automated Custom Domain Provisioning (Vercel REST API)

When a customer enters `theirbusiness.com` in their portal, our server action calls `POST https://api.vercel.com/v10/projects/[projectId]/domains`. The system generates instructions for an A Record pointing to `76.76.21.21` and CNAME to `cname.vercel-dns.com`. Real-time polling verifies DNS propagation and issues Let's Encrypt SSL certificates automatically.