Data model
Main relationships
- Company ← (many) Customer ← (many) Contact (email / linkedin URL / phone / telegram chat ID)
- Customer ↔ Tag (many-to-many, free-form +
bot:system prefix for autoreply control) - Customer ↔ Segment (membership; static or dynamic)
- Customer → FitAssessment (score per criterion per product, with history)
- Customer → ActivityLog (every event)
- Customer → Note (markdown, internal)
- Customer → Task (to-do items)
- Deal → Customer (primary contact) + Company
- Deal → DealStage enum (open / negotiating / won / lost)
CRM tabs
Customers
The main contact book. Detail drawer with 4 tabs. Bulk operations.
Companies
Legal entities. Merge, domain auto-match.
Segments
Static + dynamic. Targets for campaigns.
Deals
Pipeline kanban + list. Stage tracking.
Leads
Customer fit ranking per product, human review.
Tasks
Pool + assigned. Polymorphic anchor.
Notes
Internal markdown. Per customer / deal / company.
Tags
Tag library. System tags + custom.
Scoring
Fit criteria + assessments per product.
Core principles
A customer is a person; a contact is a channel. One customer can have 3 contacts (work email, personal email, LinkedIn). When sending a message, automation picks a channel + credential; the channel maps to the matching contact on that customer.
Ownership scoping (WIP)
| Role | Customer | Deal | Inbox |
|---|---|---|---|
| owner / admin | read + write org-wide | read + write org-wide | read + reply org-wide |
| member | read org-wide, write own or unclaimed | same | reply own or pool |
Customer.claimedById = the sales-rep owner. Set via:
- Sales rep claims from the drawer
- The
assign-ownerautomation node - Bulk claim from the customer table
Activity log
Every customer event is logged. Each entry has:- The customer involved
- An event type (discriminator)
- Per-type detail data
- A timestamp
Event types recorded
| Group | Types |
|---|---|
| sent, opened, clicked, replied, bounced | |
| LinkedIn / Telegram | sent, replied |
| Tag | added, removed |
| Segment | joined, left |
| Bot | replied, escalated |
| Task | created, completed |
| Owner | claimed, released |
| Profile | scored |
| Note | added |
| Deal | created |