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.
- Routing: Handled entirely via
proxy.tsat 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.
- Install dependencies:
pnpm install- Run the development server:
pnpm run dev- Test the multi-tenant routing locally:
http://acme.localhost:3000-> Resolves to the "Acme Corp" tenanthttp://myapp.localhost:3000-> Resolves to the "My App Org" tenanthttp://localhost:3000-> Fails over to the custom 404/not-found logic
pnpm run test