UUID Use Case

UUID Tenant ID

In a shared database, the tenant UUID is the wall between customers. Miss the filter and you leak data across tenants.

Isolation boundaryRow-scopedv4

Generated locally with the Web Crypto API — nothing leaves your browser.

What Is UUID Tenant ID?

How to generate

  1. Add tenant_id to every tenant-facing table.
  2. Enforce scoping in a repository/query layer.
  3. Audit queries for missing tenant filters.

Use Cases

Code Examples

PostgreSQL
CREATE POLICY tenant_isolation ON invoices
  USING (tenant_id = current_setting('app.tenant')::uuid);

Frequently Asked Questions

UUID or string tenant slug?
Slug is human-friendly for the URL; UUID is the internal key. Use both, with the UUID as the FK.
Row-level security or app scoping?
Both — RLS is defence-in-depth when app code forgets the filter.

Related tools