Open-Source Wikis

/

Cal.com

/

Primitives

/

User

calcom/cal.com

User

The universal account record. Every other primitive has a relation back to User directly or transitively.

Schema highlights

packages/prisma/schema.prismaUser:

  • id, username, name, email, emailVerified
  • password (hashed), bio, avatarUrl, timeZone, weekStart
  • theme, appTheme, defaultScheduleId
  • bufferTime, hideBranding, verified, disableImpersonation
  • role enum (USER, ADMIN, ...)
  • identityProvider enum (CAL, GOOGLE, GITHUB, SAML — last one is upstream-only)
  • identityProviderId
  • metadata (JSON), locale, timeFormat, trialEndsAt
  • twoFactorSecret, twoFactorEnabled, backupCodes
  • createdDate, updatedAt, lastActiveAt
  • bookingLimits, appsLastSync
  • Many relations: eventTypes, bookings, schedules, selectedCalendars, destinationCalendar, credentials, apiKeys, webhooks, tokens, accounts, sessions, memberships, profiles, feedback, ...
  • Account — NextAuth's per-provider linkage (Google, GitHub, ...).
  • Session — NextAuth session row.
  • Profile — organization profile binding (per-org username).
  • Membership — team / organization membership with role.

Where it lives in code

Concern File
Domain packages/features/users/, packages/features/profile/
Auth packages/features/auth/
Sessions packages/features/auth/lib/getServerSession.ts
Repository packages/features/users/...Repository.ts
Settings UI apps/web/modules/settings/, apps/web/app/(use-page-wrapper)/.../settings/
Bot detection on signup packages/features/bot-detection, packages/features/watchlist

Important behaviors

  • Identity provider — a user can authenticate via password, Google, GitHub, or magic link. The identityProvider column captures the last-used provider; the Account table holds the per-provider linkage.
  • Profiles — when a user joins an organization, a Profile row is created so they can have a different username under that organization. The Profile is linked from EventType, Booking, etc.
  • 2FA — TOTP-based; the secret is stored encrypted with CALENDSO_ENCRYPTION_KEY.
  • DefaultsdefaultScheduleId is the schedule new event types inherit; timeZone, weekStart, theme, locale are user-level defaults that propagate down.
  • Bot defense — signup is gated by packages/features/watchlist (free email domains list) and packages/features/bot-detection.

Consumers

Pretty much everything. The booking pipeline reads the organizer's user, the slot computation reads the user's schedules and selected calendars, the dashboard reads the user's settings, the API v2 maps API keys / OAuth tokens back to a user.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

User – Cal.com wiki | Factory