Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

platforms

> 前端框架
Open source

A full-stack Next.js app with multi-tenancy.

6.7K stars0 likes3 views
WebsiteGitHub

About

A full-stack Next.js app with multi-tenancy.

Next.js Multi-Tenant Example

A production-ready example of a multi-tenant application built with Next.js 16, featuring custom subdomains for each tenant.

Features

  • ✅ Custom subdomain routing with Next.js proxy
  • ✅ Tenant-specific content and pages
  • ✅ Shared components and layouts across tenants
  • ✅ Redis for tenant data storage
  • ✅ Admin interface for managing tenants
  • ✅ Emoji support for tenant branding
  • ✅ Support for local development with subdomains
  • ✅ Compatible with Vercel preview deployments

Tech Stack

  • Next.js 16 with App Router
  • React 19
  • Upstash Redis for data storage
  • Tailwind 4 for styling
  • shadcn/ui for the design system

Getting Started

Prerequisites

  • Node.js 20.9.0 or later
  • pnpm (recommended) or npm/yarn
  • Upstash Redis account (for production)

Installation

  1. Clone the repository:

    bash
    git clone https://github.com/vercel/platforms.git
    cd platforms
  2. Install dependencies:

    bash
    pnpm install
  3. Set 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_token
  4. Start the development server:

    bash
    pnpm dev
  5. Access the application:

    • Main site: http://localhost:3000
    • Admin panel: http://localhost:3000/admin
    • Tenants: http://[tenant-name].localhost:3000

Multi-Tenant Architecture

This application demonstrates a subdomain-based multi-tenant architecture where:

  • Each tenant gets their own subdomain (tenant.yourdomain.com)
  • The proxy handles routing requests to the correct tenant
  • Tenant data is stored in Redis using a subdomain:{name} key pattern
  • The main domain hosts the landing page and admin interface
  • Subdomains are dynamically mapped to tenant-specific content

The proxy (proxy.ts, the Next.js 16 replacement for middleware.ts) intelligently detects subdomains across various environments (local development, production, and Vercel preview deployments).

Deployment

This application is designed to be deployed on Vercel. To deploy:

  1. Push your repository to GitHub
  2. Connect your repository to Vercel
  3. Configure environment variables
  4. Deploy

For custom domains, make sure to:

  1. Add your root domain to Vercel
  2. Set up a wildcard DNS record (*.yourdomain.com) on Vercel

Issues· 23 open

View all issuesOpen on GitHub
  • #485

    Hey, I have a CMS based on this project...

    Updated Feb 21, 2026
  • #478

    Does not work static rendering and ISR after update Next to 15.5+ ver

    Updated Oct 16, 2025
  • #464

    is there a way to use root domain for tenant

    Updated Sep 22, 2025
  • #456

    Subdomain Pages Bypass

    Updated Sep 19, 2025
  • #463

    Lack of licence

    Updated Jun 20, 2025
  • #462

    Query Parameters Lost After Middleware Rewrite for Subdomain Routing in Next.js App Router

    Updated Jun 20, 2025
  • #458

    Custom Domain Bindings

    Updated Jun 19, 2025
  • #460

    For other paths on subdomain

    Updated Jun 16, 2025
  • #459

    Sitemap and robots.txt

    Updated Jun 13, 2025
  • #457

    Approaches for tenant-specific secrets?

    Updated May 22, 2025

> Tags

TypeScriptmulti-tenancymulti-tenant-applicationsnextjstailwindcss

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 23, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架