Skip to content

basalt / tenancy/src / TENANT_ID_PATTERN

Variable: TENANT_ID_PATTERN ​

> const TENANT_ID_PATTERN: RegExp

Defined in: tenancy/src/tenant.ts:131

The canonical tenant-id grammar: 1–63 characters of lower-case ASCII letters, digits, - and _, starting with a letter or digit. Slugs, UUIDs and cuids all fit.

The id is not an opaque label: every tenant-scoped package builds a namespace out of it — tenant:<id>:<key> in the cache, tenants/<id>/<path> in storage, a channel map key in realtime, a schema or database name in the tenancy drivers. An id carrying one of those delimiters (:, /, .., whitespace, control characters) could alias another tenant's namespace, and mixed case collides on case-insensitive filesystems and DNS. So ids are held to one grammar at the point they are created.

Released under the MIT License.