Auth

Users, organizations, sessions, and invitations.

Source: packages/db/src/schema/auth.ts

Enums

EnumValues
organization_statusactive, suspended, deleted

user

Core user accounts.

ColumnTypeNotes
idtextPK
nametextNOT NULL
emailtextNOT NULL, UNIQUE
email_verifiedbooleandefault false
imagetext
created_attimestamp
updated_attimestamp
roletext
bannedbooleandefault false
ban_reasontext
ban_expirestimestamp
active_organization_idtext
modetextdefault dev

account

OAuth and credential provider links.

ColumnTypeNotes
idtextPK
account_idtextNOT NULL
provider_idtextNOT NULL
user_idtextFK → user.id, CASCADE
access_tokentext
refresh_tokentext
id_tokentext
access_token_expires_attimestamp
refresh_token_expires_attimestamp
scopetext
passwordtext
created_attimestamp
updated_attimestamp

verification

OTP and email verification tokens.

ColumnTypeNotes
idtextPK
identifiertextNOT NULL, indexed
valuetextNOT NULL
expires_attimestampNOT NULL
created_attimestamp
updated_attimestamp

jwks

JSON Web Key Set storage for token signing.

ColumnTypeNotes
idtextPK
public_keytextNOT NULL
private_keytextNOT NULL
created_attimestampNOT NULL
expires_attimestamp

organization

Workspaces / tenants.

ColumnTypeNotes
idtextPK
nametextNOT NULL
slugtextNOT NULL, UNIQUE
logotext
created_attimestampNOT NULL
metadatatext
billing_emailtext
billing_nametext
external_customer_idtextUNIQUE
statusorganization_statusdefault active

member

User ↔ organization membership.

ColumnTypeNotes
idtextPK
organization_idtextFK → organization.id, CASCADE
user_idtextFK → user.id, CASCADE
roletextdefault member
created_attimestampNOT NULL

invitation

Pending organization invites.

ColumnTypeNotes
idtextPK
organization_idtextFK → organization.id, CASCADE
emailtextNOT NULL
roletext
statustextdefault pending
expires_attimestampNOT NULL
created_attimestamp
inviter_idtextFK → user.id, CASCADE

Was this page helpful?

Edit this page