← Back to Blog
TechnicalarchitectureAzureVercel

3 Subdomains, 1 Azure Database, 1 Vercel Frontend: How I Split agenticai01.tech

agenticai01.tech needed three distinct surfaces with different infrastructure requirements. Here is why it is split across subdomains, how each layer is wired, and the tradeoffs.

SPSantosh Paudel· May 11, 2026· 8 min read· 3 views
Table of contents

Most Next.js projects are monolithic: one repository, one Vercel deployment, one Supabase database. This is the right default. Do not add complexity before you need it.

agenticai01.tech needed to be split. Here is why, and how the split is structured.

Why Split at All

The three surfaces of agenticai01.tech have genuinely different infrastructure requirements:

Marketing and discovery (root domain) — Needs CDN-level performance, full static generation, and zero database dependency for the initial render. A dynamic database connection would add 50–200ms to every page load. Static Next.js on Vercel is optimal.

Application layer (app subdomain) — Needs Supabase Auth, dynamic user-specific data, real-time agent status updates, and server-side rendering for authenticated routes. Cannot be statically generated.

API and execution layer (api subdomain) — Needs long execution timeouts (agent runs can take 30–120 seconds), CPU isolation between runs, and direct database access without going through a frontend proxy. Vercel's edge functions have a 25-second limit. Azure Functions on a consumption plan allows up to 10 minutes.

If I put all of this in one Vercel deployment, I would be fighting the platform constraints for the API layer. The split matches infrastructure to requirements.

How Each Layer Is Wired

Root domain — Static Next.js exported to Vercel. No database reads at build time beyond generating the list of featured agents. Deployed independently from the application layer.

app.agenticai01.tech — Separate Vercel project, same GitHub repository, different build target. Connects to the Azure PostgreSQL database via a connection string stored in Vercel environment variables. Supabase Auth manages user sessions — the auth layer runs through Supabase's hosted auth service, but the application data is in Azure PostgreSQL, not Supabase's PostgreSQL.

api.agenticai01.tech — Azure Functions, Node.js runtime. Each function is invoked via HTTP. The agent runner, webhook processor, and payment handler live here. Connected to the same Azure PostgreSQL database.

Cross-Domain Communication

The application layer triggers agent runs by calling the API layer:

// app.agenticai01.tech — trigger an agent run
const response = await fetch('https://api.agenticai01.tech/agents/run', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${serviceToken}`,
  },
  body: JSON.stringify({ agentId, input, userId }),
});

The service token is a shared secret between the application layer and the API layer — not a user-facing token. It is stored in Vercel and Azure environment variables respectively.

CORS is configured on the API layer to allow requests from app.agenticai01.tech only.

The Database: Why Azure Instead of Supabase

The question I get asked most: why not just use Supabase for everything?

Two reasons. First, the agent execution data has compliance considerations that made a dedicated managed PostgreSQL instance preferable to a shared Supabase project. Azure Database for PostgreSQL (Flexible Server) gives a dedicated, isolated instance.

Second, Supabase's free tier allows one project per organization. I was already using Supabase for santoshpaudel.me. A second Supabase project would require a paid plan or a second organization. Azure PostgreSQL on a Flexible Server Basic tier costs approximately $13/month — not free, but predictable.

When This Split Is Wrong

For most projects, it is wrong. A monolithic Next.js app with Supabase is simpler to deploy, debug, and maintain. The split for agenticai01.tech is justified by genuine execution time requirements (the 25-second Vercel limit) and genuine isolation requirements (the API layer handles financial transactions and should not be co-located with the marketing site).

If your project does not have these specific requirements, do not split. One Vercel deployment, one Supabase project, one mental model. Complexity has a maintenance cost that compounds over time.


Resources


Building a platform with complex multi-layer requirements? I architect and build multi-subdomain systems across Azure, Vercel, and Supabase. See my work or get in touch.

Get the free AI Prompt Pack + weekly frameworks

30+ tested prompts for images, captions, scripts & keywords, delivered instantly. Plus real insights on AI + marketing — no generic tips.

No spam. Unsubscribe anytime.

Want to implement this with guidance?

Santosh helps founders turn insights like this into real systems.

AI Content Systems

External Resources

Further Reading & Tools

Related Posts

01
2 min
Next.jsSupabase
6d agoProgrammatic SEO

The Engine Room: Architecting a 200+ Page Programmatic Content System on Next.js 15 & Supabase

Managing a handful of blogs is easy. Scaling to 200+ high-quality, vertical-specific content assets is an engineering challenge. Here is the exact programmatic database schema, static generation routing, and automated pipeline behind a high-velocity content engine.

Read article
02
9 min
Next.jsSupabase
20d agoDev Sprint

How I Shipped 4 Full-Stack Platforms in 25 Days

Four production-ready sites. One developer. Twenty-five days. Here is the exact stack, timeline, and workflow — including what broke and what made it possible.

Read article
03
8 min
portfolioadmin panel
23d agoProject Deep-Dive

Case Study: santoshpaudel.me — A Portfolio That Runs Like a Business

Most developer portfolios are digital brochures. Mine has a CRM, lead management, AI content agents, and a full admin panel. Here is what I built and why.

Read article