Type Organization
/web/src/lib/schemas/ — Zod validation schemas
auth.ts— Authentication validationteam.ts— Team/organization validationcustomer.ts— Customer data validationjob.ts— Job/ticket validationagent-config.ts— Agent configuration validation
/web/src/lib/types/ — TypeScript type definitions
conversation.ts,team.ts,agent-config.tsknowledge-base.ts,sentiment.ts,customer.tsjob.ts,call-notes.ts,inbox.ts,extraction.ts
/web/src/lib/integrations/ — Third-party integration types
types.tselevenlabs/types.tstwilio/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
- Use Zod for validation - All user input should be validated with Zod schemas
- Type conversion at boundaries - Convert database rows to domain types at the data layer
- Enum labels and colors - Use the parallel
*_LABELSand*_COLORSobjects for display - Partial schemas for forms - Use
.pick()for tab-level validation in multi-step forms