A full-stack Next.js app with multi-tenancy.
A production-ready example of a multi-tenant application built with Next.js 16, featuring custom subdomains for each tenant.
Clone the repository:
git clone https://github.com/vercel/platforms.git
cd platformsInstall dependencies:
pnpm installSet up environment variables:
Create a .env.local file in the root directory with:
KV_REST_API_URL=your_redis_url
KV_REST_API_TOKEN=your_redis_tokenStart the development server:
pnpm devAccess the application:
This application demonstrates a subdomain-based multi-tenant architecture where:
tenant.yourdomain.com)subdomain:{name} key patternThe proxy (proxy.ts, the Next.js 16 replacement for middleware.ts) intelligently detects subdomains across various environments (local development, production, and Vercel preview deployments).
This application is designed to be deployed on Vercel. To deploy:
For custom domains, make sure to:
*.yourdomain.com) on VercelHey, I have a CMS based on this project...
Does not work static rendering and ISR after update Next to 15.5+ ver
is there a way to use root domain for tenant
Subdomain Pages Bypass
Lack of licence
Query Parameters Lost After Middleware Rewrite for Subdomain Routing in Next.js App Router
Custom Domain Bindings
For other paths on subdomain
Sitemap and robots.txt
Approaches for tenant-specific secrets?