UUID Use Case

UUID Member ID

A person may belong to several organisations with different roles. A per-org member UUID captures that membership distinctly from the user.

Per-orgRole-scopedv4

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

What Is UUID Member ID?

How to generate

  1. Create members(member_uuid, user_id, account_id, role).
  2. Key membership checks on member_uuid.
  3. Reference member_uuid from posts/comments.

Use Cases

Code Examples

PostgreSQL
CREATE TABLE members (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  user_id UUID, account_id UUID, role text
);

Frequently Asked Questions

Why not just user_id + account_id?
The pair is unique, but a member UUID gives you a stable handle to reference from other tables and to revoke cleanly.
One member per org per user?
Usually yes; enforce with a UNIQUE(user_id, account_id) constraint.

Related tools