Installation
pnpm add @repo/auth
Import Paths
The package exposes four entry points:
// Components, types, gate utilities, permission helpers, 2FA schemas
import { hasAccess, createGateResult, hasPermission, PermissionsField } from '@repo/auth'
// Server-only: session retrieval, access validation
import { getSession, getUserSession, useSystemSession, runWithSession } from '@repo/auth/server'
// Client-only: gate checks against page session
import { hasAccess } from '@repo/auth/client'
// Drizzle ORM database schemas (global + tenant)
import { authSchema, tenantSchema, generalModelColumns } from '@repo/auth/database'
Types
Key types are exported from the main entry point:
import type { Gate, GateResult, Permission, Session, SessionUser, NotAuthorized } from '@repo/auth'