Skip to main content

Type Organization

/web/src/lib/schemas/ — Zod validation schemas
  • auth.ts — Authentication validation
  • team.ts — Team/organization validation
  • customer.ts — Customer data validation
  • job.ts — Job/ticket validation
  • agent-config.ts — Agent configuration validation
/web/src/lib/types/ — TypeScript type definitions
  • conversation.ts, team.ts, agent-config.ts
  • knowledge-base.ts, sentiment.ts, customer.ts
  • job.ts, call-notes.ts, inbox.ts, extraction.ts
/web/src/lib/integrations/ — Third-party integration types
  • types.ts
  • elevenlabs/types.ts
  • twilio/types.ts

Core Types

Conversation Types

Full conversation data model for call handling:

Customer Types

Customer management with full history tracking:

Agent Configuration Types

AI agent configuration with business hours, services, and transfer routing:

Job/Ticket Types

Service ticket management:

Integration Types

Twilio Types

ElevenLabs Types


Zod Schemas

All major types have corresponding Zod schemas for runtime validation:

Authentication Schema

Customer Schema

Job Schema


Type Utilities

Status Labels and Colors

Each enum-like type has corresponding label and color mappings:

Conversion Functions

Snake_case database rows are converted to camelCase TypeScript types:

Best Practices

  1. Use Zod for validation - All user input should be validated with Zod schemas
  2. Type conversion at boundaries - Convert database rows to domain types at the data layer
  3. Enum labels and colors - Use the parallel *_LABELS and *_COLORS objects for display
  4. Partial schemas for forms - Use .pick() for tab-level validation in multi-step forms