dev, check, print
Local proxy, validation, and config inspection.
multitenant dev — local proxy
Maps tenant hostnames to your app's dev server and injects headers (x-tenant-key, x-market-key, x-tenant-env, optional flags JSON).
npx @multitenant/cli dev [options]| Option | Default | Description |
|---|---|---|
--config | auto-discover | Path to tenants.config.json |
--cwd | process.cwd() | Working directory |
-p / --port | 3100 | Proxy listen port |
-t / --target | http://localhost:3000 | Your app URL |
--run-dev | off | Spawn npm/pnpm/yarn run dev` |
--env | local | local | development | staging | production |
Behaviour: load + validate config → build registry → proxy → forward Host resolution as headers → watch config file and hot-reload registry.
Examples
npx @multitenant/cli dev --target http://localhost:3000 --port 3100
npx @multitenant/cli dev --run-dev --port 3100Then open e.g. http://us.localhost:3100 — use a hostname from your config’s domains.local (first label is often the tenant subdomain), not http://localhost:3100. localhost is not a tenant host, so the proxy cannot resolve a tenant (it responds with a short HTML hint listing example hosts).
Browsing http://us.localhost:3000 with next dev on 3000 is also valid: no proxy, but Host still matches domains.local.
multitenant check
Validates tenants.config.json and exits 0 or 1 with the same errors validateTenantsConfig throws in code.
npx @multitenant/cli checkUse in CI next to your tests.
multitenant print
Prints a normalized view of the config (tenants, domains per environment) — useful for debugging large files. Run multitenant print --help for flags.