Platforms Starter Kit

R
Renaudil y a 2 jours
0

Description

Next.js template for building multi-tenant applications with the App Router and Redis.

npx boilerapp platforms-starter-kit

文档

Next.js Multi-Tenant Example

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

Features

  • ✅ Custom subdomain routing with Next.js middleware
  • ✅ 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

Getting Started

Prerequisites

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

Installation

  1. Clone the repository:

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

    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:

    pnpm dev
    
  5. Access the application:

Multi-Tenant Architecture

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

  • Each tenant gets their own subdomain (tenant.yourdomain.com)
  • The middleware 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 middleware (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

Prix

Gratuit

FREE

评论 (0)

常见问题

常见问题解答 (FAQ)

有问题?我们有答案。如果您找不到想要的答案,请随时联络我们。

Boilerapp 是一个专门用于分享 Boilerplates、入门套件(Starter Kits)和项目模版的开发者社区平台。我们的目标很简单:为您节省初始配置(Setup)的时间,让您可以专注于真正重要的代码。无论您是在寻找简单的代码库还是完整的 SaaS 项目,都能在这里找到。

还有其他问题?

我们的团队随时为您提供帮助。联络我们,我们将尽快回复。

Platforms Starter Kit | BoilerApp