From mblode-agent-skills
Provides architecture guidance for multi-tenant SaaS platforms on Cloudflare or Vercel. Use when defining domain strategy, tenant identification, isolation, subdomain routing, custom domains, white-label setup, tenant separation, plan/limit mapping, building a multi-tenant application, or asking "how do I support multiple tenants" or "build a white-label platform".
npx claudepluginhub joshuarweaver/cascade-code-general-misc-4 --plugin mblode-agent-skillsThis skill uses the workspace's default tool permissions.
0. Choose platform
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Generates original PNG/PDF visual art via design philosophy manifestos for posters, graphics, and static designs on user request.
random.acme.com damages the whole domain.acme.app for tenants, acme.com for brand).tenant.yourdomain.com. Requires wildcard DNS. Simplest for many tenants.yourdomain.com/tenant-slug. No DNS/SSL per tenant, but limits branding and complicates cookie isolation.tenant_id scoping. Middleware resolves tenant from hostname; all data queries include tenant context. Use Postgres RLS for defence-in-depth./domains/[domain] dynamic segment. Edge Config for sub-millisecond tenant lookups. 404 when no mapping exists.x-tenant-id, x-tenant-slug, x-tenant-plan on forwarded request headers. Server Components read via headers(); API routes read from request headers:
// middleware.ts
import { NextRequest, NextResponse } from "next/server";
export function middleware(request: NextRequest) {
const hostname = request.headers.get("host") ?? "";
const tenant = hostname.split(".")[0]; // resolve from DB/Edge Config in production
const response = NextResponse.next();
response.headers.set("x-tenant-id", tenant);
return response;
}
@vercel/sdk) for domain management. Database connection scoped by tenant_id or database-per-tenant (Neon).@vercel/sdk for programmatic domain CRUD + automatic Let's Encrypt SSL. Wildcard subdomains require Vercel nameservers. See vercel-domains.md.robots.txt, sitemap.xml, llms.txt must vary by tenant; do not serve from /public.random.acme.com damages the entire acme.com reputation. Use a separate TLD for tenant workloads.