Data model
Every main record in Accordee, how they connect, and where each one lives today. Use it as the starting point for your own database.
The records
Field names are the ones in the code, in the types under src/lib/data. Customers use number IDs; everything else uses short text IDs such as CT-1013 for a contract or LD-1001 for a lead.
| Record | What it is | Key fields |
|---|---|---|
| Workspace | Your customer's company account and its settings | name, slug, currency, paymentTerms, renewalWindow; settings for pipeline stages, tags, custom fields and agents sit alongside it |
| Members | People on the team who sign in | name, email, role (owner, admin, member, guest), title, status (active, invited) |
| Customers | Companies you work with | name, location, founder, employees, website, tags, rating, owner; the profile adds legal, email, about and logo |
| Contacts | People at a customer | customerId, name, role, email, phone, primary |
| People (Network) | Everyone you work with, with how strong the relationship is. Worked out, not stored | Built from contacts, lead contacts, contract signers and email. strength (strong, good, weak, cold) comes from meetings, emails, messages, notes and tasks in the last 90 days |
| Leads | A new company, or more business from a customer | kind (new, upsell), customerId, contractId once won, stage, valueUsd, plan, seats, expectedClose, source, owner, its own contacts and a stage history |
| Contracts | What a customer bought | customerId, plan (or a custom plan with its own price per seat), seats, valueUsd, billing (monthly, quarterly, annual), startDate, endDate, termMonths, autoRenew, status, owner, signerContactId |
| Invoices | Bills for a contract | contractId, customerId, issueDate, dueDate, amountUsd, status (paid, open, overdue), paidDate. Invoices written in the editor add line items, tax, discount, currency and layout |
| Transactions | Money in or out, always for an invoice | invoiceId, contractId, customerId, type (payment, refund), status, method, brand, amountUsd |
| Balances | What each customer owes, by age. Worked out from invoices, not stored | outstanding, overdue, age buckets and the unpaid invoices |
| Documents and files | Company documents, and files sent in messages and emails | Documents: name, summary, customerId, uploadedBy, uploadedAt, size. Files: name, kind, size. Only these details are kept today, not the file itself |
| Emails | Threads from the connected mailbox | subject, folder, customerId, contactId, messages (from, to, cc, body, files); plus suggested contacts and companies found in email |
| Messages | Conversations with customer contacts | customerId, contactId, subject, about (a contract or invoice), participants, teammates, messages with files, readUpTo, muted, closed |
| Inbox | Notifications for the signed-in person | kind, category, title, body, at, and the records it's about. Today they're worked out from recent records |
| Meetings | Calls with a customer or a lead | customerId or leadId, contactIds, team, date, start, minutes, app, agent, agenda |
| Tasks | To-dos on one record | title, record (a customer, contract, invoice or lead), customerId, owner, dueDate, done |
| Notes | Written by your team or by an AI agent | customerId or leadId, author, title, body, source (user, ai), links to a meeting, contract, transaction, message thread, task, app or workflow |
| Whiteboards | Boards for planning with a customer | name, customerId, contractId, templateId, owner, and the board's objects and connectors. Record cards on a board point to a customer, contact, contract or task |
| Workflows and runs | Automations that act across records | trigger, schedule, conditions, actions, instructions, owner, and each run's time, source and results |
| Agents and chats | AI agents and conversations with them | Agents: model, tone, instructions, access, skills, apps. Chats: a title and messages |
How they connect
| From | To | How |
|---|---|---|
| Workspace | Members | One to many |
| Members | Customers, leads, contracts, tasks, workflows, whiteboards | The owner field |
| Customer | Contacts, contracts, documents | One to many, by customerId |
| Customer | Leads | An upsell belongs to a customer; a won lead points to the customer it became |
| Lead | Contract | A won lead points to its draft contract (contractId) |
| Contract | Contact | The signer (signerContactId) |
| Contract | Invoices | One to many |
| Invoice | Transactions | One to many: payments and refunds |
| Customer | Messages, emails, meetings, notes, tasks | By customerId; messages and emails also name a contact, meetings list contacts |
| Lead | Meetings, notes, tasks | Before a lead is a customer, by leadId |
| Message thread | Contract or invoice | What the conversation is about (about) |
| Task | Customer, contract, invoice or lead | Exactly one (record) |
| Note | Meeting, contract, transaction, thread, task, app or workflow | Any number (links) |
| Whiteboard | Customer, contract | Optional links; record cards point to customers, contacts, contracts and tasks |
| Person (Network) | Customers, contracts, leads | Worked out from contacts, lead contacts, signers and email |
| Workflow | Runs | One to many |
Where they live today
Sample records live in src/lib/data. Each module's provider in src/components/providers starts from them and keeps changes in memory. To go live, a provider loads its records from your backend and sends its changes there; the screens stay as they are. Database shows how, one module at a time.
| Records | Sample data | Provider |
|---|---|---|
| Workspace, members, settings, agent setup | admin.ts | AdminProvider |
| Customers and contacts | customers.ts, records.ts | CustomersProvider |
| People (Network) | network.ts | NetworkProvider |
| Leads | leads.ts | LeadsProvider |
| Contracts | records.ts | ContractsProvider |
| Invoices, transactions, balances | records.ts, billing.ts, invoice-docs.ts | InvoicesProvider |
| Documents | documents.ts | DocumentsProvider |
| Emails | emails.ts | EmailsProvider |
| Messages, notes, tasks | comms.ts | CommsProvider |
| Inbox | Worked out from records | InboxProvider |
| Meetings and meeting notes | meetings.ts | MeetingsProvider |
| Whiteboards | whiteboards.ts | WhiteboardsProvider |
| Workflows and runs | workflows.ts | WorkflowsProvider |
| Agents and chats | agents.ts, admin.ts | ChatProvider |
Before you design tables
- Owners and authors are names today. Fields like
owner,authoranduploadedByhold a member's name. In a database, store the member's ID. - Prospects have no customer yet. Notes, meetings and tasks on a lead that isn't a customer use
customerId: -1and aleadId. In a database, make the customer optional and move them across when the lead is won. - Some things are worked out, not stored. Network people and their strength, customer balances, invoice lists and dashboard numbers are calculated from other records. Store the records; calculate these, or use database views.
- Runs and stage changes are lists inside a record. Workflow runs and a lead's stage history live inside the workflow and the lead. Give them their own tables.
- One workspace in the demo. The demo keeps a single workspace in the browser. A real product usually has many, so add a workspace to every record.
Suggested tables
An outline for Postgres: table names, main columns and links (→). Columns marked + aren't in the demo; a real backend needs them. Adjust it to your product, then follow Database to create the tables and switch one module at a time.
Lists such as tags, lines, conditions and a board's content can start as JSON columns. Split them into tables when you need to search or report on them.