Skip to main content

Multi-tenancy

The application supports multi-tenant behavior: different universities (or units) can be distinguished by host and tenant metadata.

Middleware (src/middleware.ts)

The middleware derives a tenant identifier from the request host and forwards it (for example as x-tenant-id) for internal Next.js requests.

  • Localhost is skipped so day-to-day dev on 127.0.0.1 stays simple.
  • Middleware behavior may depend on host patterns (for example subdomain rules described in the upstream README).

Local testing with a custom host

To exercise tenant routing locally, map a hostname to your machine (e.g. in the Windows hosts file) and open the app on that host and port. The upstream README suggests patterns such as tenant-dev.local pointing at 127.0.0.1.

API client

Separately, the Axios layer may send X-Tenant-Domain (from the auth store) on upstream calls. See the code and your backend contract for authoritative behavior.

:::info Expand with your deployment model

Document your real domains, how new tenants are provisioned, and any DNS or reverse-proxy requirements when you harden this section.

:::