Skip to content

Repository files navigation

next-tenants

A minimal, multi-tenant architecture.

This project explores the new proxy.ts feature to handle edge-level host rewriting without the overhead of heavy middlewares.

Architecture

  • Routing: Handled entirely via proxy.ts at the edge. Intercepts incoming host headers and rewrites the path to dynamic tenant routes (app/[tenant]).
  • Data Store: Tenant configurations (domains, subdomains, IDs) are managed in a static JSON file.
  • Testing: Setup with Vitest to ensure proxy and resolver logic remain solid.

Getting Started

  1. Install dependencies:
pnpm install
  1. Run the development server:
pnpm run dev
  1. Test the multi-tenant routing locally:
  • http://acme.localhost:3000 -> Resolves to the "Acme Corp" tenant
  • http://myapp.localhost:3000 -> Resolves to the "My App Org" tenant
  • http://localhost:3000 -> Fails over to the custom 404/not-found logic

Tests

pnpm run test

About

Minimal, multi-tenant nextjs architecture

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages