# triswijaya/dealflow architecture

> Architecture diagram of the GitHub repository triswijaya/dealflow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/triswijaya/dealflow
- Repository: https://github.com/triswijaya/dealflow

## Overview

DealFlow is a multi-tenant B2B sales-to-cash application. A user manages a customer and deal through pipeline stages, creates and revises quotations, follows up, records a deal outcome, and carries won business into orders, invoices, and payments. The graph preserves the documented dashboard, search, reporting, settings, and team capabilities. Evidence is limited to the README and supplied source excerpts/index; unverified implementation links are omitted.

Main entry points: [`src/server/deals/deal-views.ts`](https://github.com/triswijaya/dealflow/blob/main/src/server/deals/deal-views.ts) (Deals and pipeline), [`src/server/search/search.ts`](https://github.com/triswijaya/dealflow/blob/main/src/server/search/search.ts) (Global search), [`src/server/invoices/invoice-views.ts`](https://github.com/triswijaya/dealflow/blob/main/src/server/invoices/invoice-views.ts) (Invoices), [`src/server/customers/customers.ts`](https://github.com/triswijaya/dealflow/blob/main/src/server/customers/customers.ts) (Customer records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and workspace"]
  node_auth["Authentication and roles<br/>[auth.ts]"]
  node_workspace["App workspace<br/>[workspace.ts]"]
  node_dashboard["Role dashboards"]
  node_search["Global search<br/>[search.ts]"]
  node_settings["Company and members"]
end

subgraph group_sales["Sales journey"]
  node_customers["Customer records<br/>[customers.ts]"]
  node_deals["Deals and pipeline<br/>[deal-views.ts]"]
  node_quotations["Quotations and revisions<br/>[quotations.ts]"]
  node_followups["Follow-ups"]
  node_whatsapp["WhatsApp links"]
  node_orders["Orders"]
end

subgraph group_finance["Billing and reporting"]
  node_invoices["Invoices<br/>[invoice-views.ts]"]
  node_payments["Payments<br/>[payments.ts]"]
  node_reports["Reports and exports"]
end

subgraph group_platform["Shared services"]
  node_pdf["Document PDFs"]
  node_outbox["Outbox delivery<br/>[handlers.ts]"]
  node_email["Email delivery<br/>[send-email.ts]"]
  node_database[("PostgreSQL data<br/>[schema.ts]")]
end

node_user(("Business user"))

node_user -->|"signs in"| node_auth
node_auth -->|"grants access"| node_workspace
node_user -->|"manages customers"| node_customers
node_customers -->|"starts sales journey"| node_deals
node_deals -->|"creates quotation"| node_quotations
node_deals -->|"schedules follow-up"| node_followups
node_followups -->|"offers WhatsApp links"| node_whatsapp
node_deals -->|"hands off won deal"| node_orders
node_orders -->|"supports invoicing"| node_invoices
node_invoices -->|"records payments"| node_payments
node_user -->|"views metrics"| node_dashboard
node_user -->|"searches records"| node_search
node_user -->|"exports reports"| node_reports
node_user -->|"configures workspace"| node_settings
node_quotations -->|"renders quotation"| node_pdf
node_invoices -->|"renders invoice"| node_pdf
node_outbox -->|"renders attachments"| node_pdf
node_outbox -->|"sends messages"| node_email
node_search -->|"queries customers"| node_customers
node_search -->|"queries deals"| node_deals
node_search -->|"queries invoices"| node_invoices
node_search -->|"queries quotations"| node_quotations
node_deals -.->|"reads deal data"| node_database
node_customers -.->|"reads and writes"| node_database
node_quotations -.->|"reads and writes"| node_database
node_invoices -.->|"reads invoice data"| node_database

click node_auth "https://github.com/triswijaya/dealflow/blob/main/src/server/auth/auth.ts"
click node_workspace "https://github.com/triswijaya/dealflow/blob/main/src/app/(app)/workspace.ts"
click node_customers "https://github.com/triswijaya/dealflow/blob/main/src/server/customers/customers.ts"
click node_deals "https://github.com/triswijaya/dealflow/blob/main/src/server/deals/deal-views.ts"
click node_quotations "https://github.com/triswijaya/dealflow/blob/main/src/server/quotations/quotations.ts"
click node_followups "https://github.com/triswijaya/dealflow/tree/main/src/server/follow-ups"
click node_whatsapp "https://github.com/triswijaya/dealflow/tree/main/src/server/whatsapp"
click node_orders "https://github.com/triswijaya/dealflow/tree/main/src/server/orders"
click node_invoices "https://github.com/triswijaya/dealflow/blob/main/src/server/invoices/invoice-views.ts"
click node_payments "https://github.com/triswijaya/dealflow/blob/main/src/server/invoices/payments.ts"
click node_dashboard "https://github.com/triswijaya/dealflow/tree/main/src/server/dashboard"
click node_search "https://github.com/triswijaya/dealflow/blob/main/src/server/search/search.ts"
click node_reports "https://github.com/triswijaya/dealflow/tree/main/src/server/reports"
click node_settings "https://github.com/triswijaya/dealflow/tree/main/src/server/settings"
click node_pdf "https://github.com/triswijaya/dealflow/blob/main/src/server/pdf/quotation-document.tsx"
click node_outbox "https://github.com/triswijaya/dealflow/blob/main/src/server/outbox/handlers.ts"
click node_email "https://github.com/triswijaya/dealflow/blob/main/src/server/email/send-email.ts"
click node_database "https://github.com/triswijaya/dealflow/blob/main/src/server/db/schema.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_auth,node_workspace,node_dashboard,node_search,node_settings,node_user toneBlue
class node_customers,node_deals,node_quotations,node_followups,node_whatsapp,node_orders toneAmber
class node_invoices,node_payments,node_reports toneMint
class node_pdf,node_outbox,node_email,node_database toneRose
```

## Components

### Access and workspace

- [Authentication and roles](https://github.com/triswijaya/dealflow/blob/main/src/server/auth/auth.ts): `src/server/auth/auth.ts`
- [App workspace](https://github.com/triswijaya/dealflow/blob/main/src/app/(app)/workspace.ts): `src/app/(app)/workspace.ts`
- [Role dashboards](https://github.com/triswijaya/dealflow/tree/main/src/server/dashboard): `src/server/dashboard`
- [Global search](https://github.com/triswijaya/dealflow/blob/main/src/server/search/search.ts): `src/server/search/search.ts`
- [Company and members](https://github.com/triswijaya/dealflow/tree/main/src/server/settings): `src/server/settings`

### Sales journey

- [Customer records](https://github.com/triswijaya/dealflow/blob/main/src/server/customers/customers.ts): `src/server/customers/customers.ts`
- [Deals and pipeline](https://github.com/triswijaya/dealflow/blob/main/src/server/deals/deal-views.ts): `src/server/deals/deal-views.ts`
- [Quotations and revisions](https://github.com/triswijaya/dealflow/blob/main/src/server/quotations/quotations.ts): `src/server/quotations/quotations.ts`
- [Follow-ups](https://github.com/triswijaya/dealflow/tree/main/src/server/follow-ups): `src/server/follow-ups`
- [WhatsApp links](https://github.com/triswijaya/dealflow/tree/main/src/server/whatsapp): `src/server/whatsapp`
- [Orders](https://github.com/triswijaya/dealflow/tree/main/src/server/orders): `src/server/orders`

### Billing and reporting

- [Invoices](https://github.com/triswijaya/dealflow/blob/main/src/server/invoices/invoice-views.ts): `src/server/invoices/invoice-views.ts`
- [Payments](https://github.com/triswijaya/dealflow/blob/main/src/server/invoices/payments.ts): `src/server/invoices/payments.ts`
- [Reports and exports](https://github.com/triswijaya/dealflow/tree/main/src/server/reports): `src/server/reports`

### Shared services

- [Document PDFs](https://github.com/triswijaya/dealflow/blob/main/src/server/pdf/quotation-document.tsx): `src/server/pdf/quotation-document.tsx`
- [Outbox delivery](https://github.com/triswijaya/dealflow/blob/main/src/server/outbox/handlers.ts): `src/server/outbox/handlers.ts`
- [Email delivery](https://github.com/triswijaya/dealflow/blob/main/src/server/email/send-email.ts): `src/server/email/send-email.ts`
- [PostgreSQL data](https://github.com/triswijaya/dealflow/blob/main/src/server/db/schema.ts): `src/server/db/schema.ts`

### Other components

- **Business user**

## Connections

- Business user → Authentication and roles: signs in
- Authentication and roles → App workspace: grants access
- Business user → Customer records: manages customers
- Customer records → Deals and pipeline: starts sales journey
- Deals and pipeline → Quotations and revisions: creates quotation
- Deals and pipeline → Follow-ups: schedules follow-up
- Follow-ups → WhatsApp links: offers WhatsApp links
- Deals and pipeline → Orders: hands off won deal
- Orders → Invoices: supports invoicing (evidence: `src/server/invoices/invoice-views.ts`)
- Invoices → Payments: records payments
- Business user → Role dashboards: views metrics
- Business user → Global search: searches records
- Business user → Reports and exports: exports reports
- Business user → Company and members: configures workspace
- Quotations and revisions → Document PDFs: renders quotation (evidence: `src/app/api/quotations/[quotationId]/pdf/route.ts`)
- Invoices → Document PDFs: renders invoice (evidence: `src/app/api/invoices/[invoiceId]/pdf/route.ts`)
- Outbox delivery → Document PDFs: renders attachments (evidence: `src/server/outbox/handlers.ts`)
- Outbox delivery → Email delivery: sends messages (evidence: `src/server/outbox/handlers.ts`)
- Global search → Customer records: queries customers (evidence: `src/server/search/search.ts`)
- Global search → Deals and pipeline: queries deals (evidence: `src/server/search/search.ts`)
- Global search → Invoices: queries invoices (evidence: `src/server/search/search.ts`)
- Global search → Quotations and revisions: queries quotations (evidence: `src/server/search/search.ts`)
- Deals and pipeline → PostgreSQL data: reads deal data (evidence: `src/server/deals/deal-views.ts`)
- Customer records → PostgreSQL data: reads and writes (evidence: `src/server/customers/customers.ts`)
- Quotations and revisions → PostgreSQL data: reads and writes (evidence: `src/server/quotations/quotations.ts`)
- Invoices → PostgreSQL data: reads invoice data (evidence: `src/server/invoices/invoice-views.ts`)
