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?
- Every table carries a tenant_id UUID; the data layer injects it into every query so a row can never be read outside its tenant.
- UUIDs make the ids unguessable, reducing the impact of a forgotten filter.
How to generate
- Add tenant_id to every tenant-facing table.
- Enforce scoping in a repository/query layer.
- Audit queries for missing tenant filters.
Use Cases
- B2B SaaS platforms.
- Marketplaces with seller data.
- Agencies managing clients.
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
UUID v1 GeneratorUUID v3 GeneratorUUID v4 GeneratorUUID v5 GeneratorUUID v6 GeneratorUUID v7 GeneratorUUID v8 GeneratorBulk UUID GeneratorShort UUID GeneratorUUID ValidatorUUID FormatterUUID as a Primary KeyUUID Database IDUUID Foreign KeyUUID Shard KeyUUID Partition KeyUUID in a Composite KeyUUID Surrogate KeyUUID API KeyUUID Session TokenUUID Access TokenUUID Refresh TokenUUID Idempotency KeyUUID Request IDUUID Correlation IDUUID Trace IDUUID CSRF TokenUUID NonceUUID FilenameUUID Object KeyUUID S3 KeyUUID Upload IDUUID Cache KeyUUID Blob NameUUID Temp FileUUID User IDUUID Account IDUUID Customer IDUUID Device IDUUID Tenant IDUUID Client IDUUID Anonymous IDUUID Member IDUUID Message IDUUID Event IDUUID Job IDUUID Task IDUUID Queue Message IDUUID Transaction IDUUID Order IDUUID Invoice IDUUID Payment IDUUID Reset TokenUUID Verification TokenUUID Invite CodeUUID API SecretUUID Share LinkUUID Magic LinkUUID Node IDUUID Worker IDUUID Lock IDUUID Cluster IDUUID Test DataUUID Seed DataUUID FixtureUUID Mock IDUUID Placeholder IDUUID Sample ID