Organization Concept

How organizations work in this repo.

Organizations are separate records in the database. Users join them through memberships, and the active organization is stored on the session.

Source of Truth

  • organizations: packages/database/src/prisma/schema.prisma
  • session context: packages/better-auth/src/context.ts
  • client hook: @kit/better-auth/hooks/use-account-context

Important Repo Detail

This repo does not model a shared accounts table for personal and organization contexts. Personal context is the absence of an active organization; organization context is driven by session.activeOrganizationId.