Skip to content

Architecture

How picrm keeps customer work inside clear boundaries.

A multi-tenant Cloudflare application with one verified identity boundary, one Drizzle data path, product-scoped work, and auditable agent execution.

Trust boundaries

Identity, tenancy, authorization, and data ownership stay explicit at every layer.

Identity and tenancy

Better Auth manages users, sessions, organizations, memberships, invitations, and roles. The server derives the active organization from the verified session. Clients and models cannot select an arbitrary tenant.

Products and access

A workspace can operate several products without duplicating customers. Companies and contacts share identity, while deals, pipelines, lists, views, forms, agents, jobs, drafts, and reports inherit one active product. Owners and admins retain workspace authority; explicit product grants constrain member visibility.

Data layer

The Drizzle schema is the source of truth and Drizzle Kit generates every migration. Application reads and writes use the Drizzle D1 driver. Every customer-owned row carries organization identity and every CRM request scopes it from the signed-in session.

Security and telemetry

Provider tokens are encrypted before storage. Operational telemetry retains bounded route patterns, status, duration, error classes, and scheduled outcomes while excluding CRM payloads. The public health probe performs a real Drizzle-backed D1 round trip.

Customer system

One connected model supports flexible records, daily work, communication, and reporting.

Records and fields

Companies, contacts, and deals support tenant-scoped editing, explicit relationships, and typed custom fields. Text, number, date, boolean, select, relationship, formula, and rollup values remain validated, auditable, and available to the record context only when configured.

Views, lists, and imports

Saved views persist compound filters, prioritized sorts, and visible columns without copying records. Shared Lists add product-scoped membership and workflow fields. CSV imports and bulk updates are capped, previewed, revalidated at commit, and rejected atomically when a row is invalid.

Work and history

Tasks, comments, mentions, notifications, notes, calls, meetings, and synchronized calendar events stay connected to their customer records. Human context and system activity remain distinct, with actor and target evidence available to authorized managers.

Reporting

Product-scoped dashboards retain the saved question, filters, calculation state, and contributing records. Deal values stay in their native currency; reporting uses explicit frozen rates and discloses missing conversions instead of silently adding unlike currencies.

Mail and connections

Gmail, Zoho Mail, AgentMail, and Cloudflare Email implement one mailbox boundary. Google, Microsoft, and Slack connections store encrypted workspace credentials with explicit product grants. Missing optional providers remove that capability without breaking the core CRM.

Governed agents

Agent versions, runtime evidence, and delivery approval make automation inspectable.

Builder and versions

Owner-authored conversations can save only a validated review draft. Team agents compile to immutable manifests with selected-record or workspace scope, explicit triggers, approved models, context limits, provider grants, and bounded capabilities. Editing and deployment remain separate actions.

Runtime and audit

Flue hosts agent conversations on Durable Objects. Each run retains its trigger, principal, product, version, model, ordered events and actions, outcome, token use, and settled cost evidence. Retries remain pinned to their accepted version and context boundary.

Human approval

Email tools create tenant-scoped drafts. Slack tools create an approval request for one exact destination and payload. Neither delivers until a separate authenticated teammate approves what will be sent.

Agent evaluations

Deterministic Miniflare evaluations require inert review drafts, validated immutable manifests, disabled triggers before deployment, ordered runtime provenance, settled usage, and actions that remain inside the deployed grant. Known-unsafe fixtures must fail.

Ready to work inside those boundaries?

Create an account, start with one product, and review every connection or agent grant before it becomes available.

Create account