CRM Architecture
Status
- document type: current state plus target direction
- source of truth for current implementation: code
- source of truth for future shape: planning direction
Current Implemented State
The current codebase does not yet implement a full shared CRM engine. What exists today:Contactas the person-level recordCompanyas the organization-level recordNotefor internal contact notesLabelfor lightweight classificationCustomAttributeDefinitionplus JSONB values forContactandConversation- conversation history, search, reporting, and help center around the support platform
DealTaskPipelineStage- normalized
Activity
Current CRM-Adjacent Model
Core Principle
- build one shared CRM engine, not separate CRM products for each vertical
- keep current support-platform primitives reusable while CRM grows
- treat target CRM entities as roadmap until implemented in code
Target Shared CRM Model
Onelink should implement one shared CRM engine on top of the current person, organization, and communication layers.Shared CRM Model
Domain Extension Model
Entity Guidance
Shared Core Entities
Current shared CRM-adjacent entities:ContactCompanyNoteLabelCustomAttributeDefinition
DealTaskPipelineStageActivity
Deal and Task should remain separate business entities because they have different lifecycle, reporting, permissions, and UX when CRM work is implemented.
Custom Attributes
Use custom attributes for:- domain-specific fields
- tenant-specific fields
- experimental or configurable fields
- core relationships
- ownership
- primary status/state
- pipeline and stage logic
Design Rule
- stable shared business state => first-class model fields and associations
- variable domain/tenant metadata => custom attributes
Recommended Build Order
- keep reusing
Contact,Company,Conversation,Note,Label, andCustomAttributeDefinition - add shared CRM entities only when the lifecycle is stable across multiple domains
- keep
DealandTaskseparate when they are introduced - add domain-specific screens, workflows, and validations only after the shared entity model is clear