CRM
The CRM (module M02 · @repo/crm) tracks the organizations you do business with, the people at them, your sales pipeline, and every interaction. It is org-scoped and enforced by Row Level Security — you only ever see your own organization's records. The module is tenancy-agnostic and ports across forks of the template.
The building blocks
- Accounts — the customer organizations you work with.
- Contacts — the people at an account.
- Opportunities — deals against an account, moving through stages: lead → qualified → proposal → won / lost.
- Activities — calls, emails, meetings, notes and tasks logged on an account's timeline.
Find it under /crm (Accounts) and /crm/pipeline (the opportunity board by stage).
Integration with projects & tasks
On F1 the CRM is wired into the project-management core:
- Opportunity → Project. From an account or the pipeline board, convert an opportunity into a delivery project; the link is shown as a “▹ Project” badge.
- Activity → Task. Turn an activity into a real task inside a project; the activity then shows a “task” badge.
These links are optional and host-specific — forks without projects/tasks simply don't have them.
Permissions
Access is governed by staff RBAC permissions, enforced by RLS:
| Area | Permissions | Roles with write |
|---|---|---|
| Accounts / Contacts | account.*, contact.* | owner, admin, member |
| Opportunities | crm.opportunity.* | owner, admin, member |
| Activities | crm.activity.* | owner, admin, member |
Viewers get read-only access; delete is restricted to owner/admin.
API access
Every CRM entity is available over the versioned REST API (API key or session auth). Full schema in the OpenAPI spec.
GET /api/v1/crm/accounts
POST /api/v1/crm/accounts
GET /api/v1/crm/contacts?account_id=…
GET /api/v1/crm/opportunities?stage=qualified
PATCH /api/v1/crm/opportunities/{id} (move stage, mark won/lost)
POST /api/v1/crm/activities