# fabielone/business-suite architecture

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

- Interactive diagram: https://gitdiagram.com/fabielone/business-suite
- Repository: https://github.com/fabielone/business-suite

## Overview

Zut CRM is an unfinished modular business-operations suite; the current client workflows are fictional demos, not live synchronized accounts. The principal documented flow is a person using a platform client to work with local/offline records and retry queued commands against the API, where authentication, membership, permissions and domain handlers govern accepted changes stored in PostgreSQL. The graph preserves CRM, production/work, money, teams, time and automation capabilities. Client-to-live-server wiring is intentionally omitted because the README says sign-in and live synchronization are unfinished; some unsampled subsystem links are likewise omitted.

Main entry points: [`packages/core/src/operations/commands.ts`](https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/commands.ts) (Domain commands), [`apps/api/src/app.ts`](https://github.com/fabielone/business-suite/blob/main/apps/api/src/app.ts) (Fastify API), [`apps/api/src/database.ts`](https://github.com/fabielone/business-suite/blob/main/apps/api/src/database.ts) (Database adapter), [`apps/web/src/operations/OperationsApp.tsx`](https://github.com/fabielone/business-suite/blob/main/apps/web/src/operations/OperationsApp.tsx) (Operations workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Platform clients"]
  node_browser["Browser app<br/>[App.tsx]"]
  node_webops["Operations workspace<br/>[OperationsApp.tsx]"]
  node_webpages["Operations pages<br/>[pages.tsx]"]
  node_automationsui["Automation settings UI<br/>[Automations.tsx]"]
  node_desktop["Desktop shell<br/>[main.ts]"]
  node_mobile["Mobile app<br/>[App.tsx]"]
end

subgraph group_offline["Offline runtime"]
  node_weboffline["Browser offline adapter<br/>[offline.ts]"]
  node_offlinecore["Shared sync queue<br/>[index.ts]"]
  node_webstore[("Browser local store<br/>[client.ts]")]
  node_mobileclient["Mobile sync client<br/>[client.ts]"]
  node_sqlitestore[("SQLite store<br/>[sqliteStore.ts]")]
end

subgraph group_server["API and persistence"]
  node_api["Fastify API<br/>[app.ts]"]
  node_auth["JWT verification<br/>[auth.ts]"]
  node_context["Membership and scope<br/>[context.ts]"]
  node_jobs["Job handlers<br/>[jobs.ts]"]
  node_expenses["Expense handlers<br/>[expenses.ts]"]
  node_operationsapi["Operations handlers<br/>[operations.ts]"]
  node_database["Database adapter<br/>[database.ts]"]
end

subgraph group_domain["Business domain"]
  node_corecommands["Domain commands<br/>[commands.ts]"]
  node_types["Business records<br/>[types.ts]"]
  node_intake["CRM and intake<br/>[intake.ts]"]
  node_production["Production workflow<br/>[production.ts]"]
  node_automation["Automations<br/>[automations.ts]"]
  node_teams["Teams and queues<br/>[teams.ts]"]
  node_calculations["Money calculations<br/>[calculations.ts]"]
  node_time["Time tracking<br/>[time.ts]"]
end

subgraph group_integrations["External services"]
  node_postgres[("PostgreSQL")]
end

node_person(("Business user"))

node_person -->|"uses"| node_browser
node_person -->|"uses"| node_mobile
node_person -->|"uses"| node_desktop
node_browser -->|"uses"| node_weboffline
node_browser -->|"renders"| node_webops
node_webops -->|"renders"| node_webpages
node_webops -->|"renders"| node_automationsui
node_webops -->|"uses"| node_webstore
node_weboffline -->|"uses"| node_offlinecore
node_mobile -->|"uses"| node_mobileclient
node_mobileclient -->|"uses"| node_offlinecore
node_mobileclient -->|"persists locally"| node_sqlitestore
node_api -->|"verifies identity"| node_auth
node_api -->|"runs in scope"| node_context
node_api -->|"dispatches jobs"| node_jobs
node_api -->|"dispatches expenses"| node_expenses
node_context -->|"queries"| node_database
node_jobs -->|"queries"| node_database
node_expenses -->|"queries"| node_database
node_api -->|"dispatches operations"| node_operationsapi
node_operationsapi -->|"queries"| node_database
node_database -->|"queries"| node_postgres
node_corecommands -->|"uses contracts"| node_types
node_corecommands -->|"uses intake rules"| node_intake
node_corecommands -->|"uses production rules"| node_production
node_corecommands -->|"runs automation rules"| node_automation
node_corecommands -->|"uses queue rules"| node_teams
node_corecommands -->|"uses calculations"| node_calculations
node_webstore -->|"executes commands"| node_corecommands
node_production -->|"uses calculations"| node_calculations
node_automation -->|"reads orders"| node_production
node_automation -->|"checks queues"| node_teams
node_person -.->|"records work"| node_time

click node_browser "https://github.com/fabielone/business-suite/blob/main/apps/web/src/App.tsx"
click node_webops "https://github.com/fabielone/business-suite/blob/main/apps/web/src/operations/OperationsApp.tsx"
click node_webpages "https://github.com/fabielone/business-suite/blob/main/apps/web/src/operations/pages.tsx"
click node_automationsui "https://github.com/fabielone/business-suite/blob/main/apps/web/src/operations/Automations.tsx"
click node_desktop "https://github.com/fabielone/business-suite/blob/main/apps/desktop/src/main.ts"
click node_mobile "https://github.com/fabielone/business-suite/blob/main/apps/mobile/src/App.tsx"
click node_weboffline "https://github.com/fabielone/business-suite/blob/main/apps/web/src/offline.ts"
click node_offlinecore "https://github.com/fabielone/business-suite/blob/main/packages/offline/src/index.ts"
click node_webstore "https://github.com/fabielone/business-suite/blob/main/apps/web/src/operations/client.ts"
click node_mobileclient "https://github.com/fabielone/business-suite/blob/main/apps/mobile/src/client.ts"
click node_sqlitestore "https://github.com/fabielone/business-suite/blob/main/apps/mobile/src/sqliteStore.ts"
click node_api "https://github.com/fabielone/business-suite/blob/main/apps/api/src/app.ts"
click node_auth "https://github.com/fabielone/business-suite/blob/main/apps/api/src/auth.ts"
click node_context "https://github.com/fabielone/business-suite/blob/main/apps/api/src/context.ts"
click node_jobs "https://github.com/fabielone/business-suite/blob/main/apps/api/src/jobs.ts"
click node_expenses "https://github.com/fabielone/business-suite/blob/main/apps/api/src/expenses.ts"
click node_operationsapi "https://github.com/fabielone/business-suite/blob/main/apps/api/src/operations.ts"
click node_database "https://github.com/fabielone/business-suite/blob/main/apps/api/src/database.ts"
click node_corecommands "https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/commands.ts"
click node_types "https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/types.ts"
click node_intake "https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/intake.ts"
click node_production "https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/production.ts"
click node_automation "https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/automations.ts"
click node_teams "https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/teams.ts"
click node_calculations "https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/calculations.ts"
click node_time "https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/time.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_browser,node_webops,node_webpages,node_automationsui,node_desktop,node_mobile,node_person toneBlue
class node_weboffline,node_offlinecore,node_webstore,node_mobileclient,node_sqlitestore toneAmber
class node_api,node_auth,node_context,node_jobs,node_expenses,node_operationsapi,node_database toneMint
class node_corecommands,node_types,node_intake,node_production,node_automation,node_teams,node_calculations,node_time toneRose
class node_postgres toneIndigo
```

## Components

### Platform clients

- [Browser app](https://github.com/fabielone/business-suite/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Operations workspace](https://github.com/fabielone/business-suite/blob/main/apps/web/src/operations/OperationsApp.tsx): `apps/web/src/operations/OperationsApp.tsx`
- [Operations pages](https://github.com/fabielone/business-suite/blob/main/apps/web/src/operations/pages.tsx): `apps/web/src/operations/pages.tsx`
- [Automation settings UI](https://github.com/fabielone/business-suite/blob/main/apps/web/src/operations/Automations.tsx): `apps/web/src/operations/Automations.tsx`
- [Desktop shell](https://github.com/fabielone/business-suite/blob/main/apps/desktop/src/main.ts): `apps/desktop/src/main.ts`
- [Mobile app](https://github.com/fabielone/business-suite/blob/main/apps/mobile/src/App.tsx): `apps/mobile/src/App.tsx`

### Offline runtime

- [Browser offline adapter](https://github.com/fabielone/business-suite/blob/main/apps/web/src/offline.ts): `apps/web/src/offline.ts`
- [Shared sync queue](https://github.com/fabielone/business-suite/blob/main/packages/offline/src/index.ts): `packages/offline/src/index.ts`
- [Browser local store](https://github.com/fabielone/business-suite/blob/main/apps/web/src/operations/client.ts): `apps/web/src/operations/client.ts`
- [Mobile sync client](https://github.com/fabielone/business-suite/blob/main/apps/mobile/src/client.ts): `apps/mobile/src/client.ts`
- [SQLite store](https://github.com/fabielone/business-suite/blob/main/apps/mobile/src/sqliteStore.ts): `apps/mobile/src/sqliteStore.ts`

### API and persistence

- [Fastify API](https://github.com/fabielone/business-suite/blob/main/apps/api/src/app.ts): `apps/api/src/app.ts`
- [JWT verification](https://github.com/fabielone/business-suite/blob/main/apps/api/src/auth.ts): `apps/api/src/auth.ts`
- [Membership and scope](https://github.com/fabielone/business-suite/blob/main/apps/api/src/context.ts): `apps/api/src/context.ts`
- [Job handlers](https://github.com/fabielone/business-suite/blob/main/apps/api/src/jobs.ts): `apps/api/src/jobs.ts`
- [Expense handlers](https://github.com/fabielone/business-suite/blob/main/apps/api/src/expenses.ts): `apps/api/src/expenses.ts`
- [Operations handlers](https://github.com/fabielone/business-suite/blob/main/apps/api/src/operations.ts): `apps/api/src/operations.ts`
- [Database adapter](https://github.com/fabielone/business-suite/blob/main/apps/api/src/database.ts): `apps/api/src/database.ts`

### Business domain

- [Domain commands](https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/commands.ts): `packages/core/src/operations/commands.ts`
- [Business records](https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/types.ts): `packages/core/src/operations/types.ts`
- [CRM and intake](https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/intake.ts): `packages/core/src/operations/intake.ts`
- [Production workflow](https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/production.ts): `packages/core/src/operations/production.ts`
- [Automations](https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/automations.ts): `packages/core/src/operations/automations.ts`
- [Teams and queues](https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/teams.ts): `packages/core/src/operations/teams.ts`
- [Money calculations](https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/calculations.ts): `packages/core/src/operations/calculations.ts`
- [Time tracking](https://github.com/fabielone/business-suite/blob/main/packages/core/src/operations/time.ts): `packages/core/src/operations/time.ts`

### External services

- **PostgreSQL**

### Other components

- **Business user**

## Connections

- Business user → Browser app: uses (evidence: `README.md`)
- Business user → Mobile app: uses (evidence: `README.md`)
- Business user → Desktop shell: uses (evidence: `README.md`)
- Browser app → Browser offline adapter: uses (evidence: `apps/web/src/App.tsx`)
- Browser app → Operations workspace: renders (evidence: `apps/web/src/main.tsx`)
- Operations workspace → Operations pages: renders (evidence: `apps/web/src/operations/OperationsApp.tsx`)
- Operations workspace → Automation settings UI: renders (evidence: `apps/web/src/operations/OperationsApp.tsx`)
- Operations workspace → Browser local store: uses (evidence: `apps/web/src/operations/OperationsApp.tsx`)
- Browser offline adapter → Shared sync queue: uses
- Mobile app → Mobile sync client: uses (evidence: `apps/mobile/src/App.tsx`)
- Mobile sync client → Shared sync queue: uses (evidence: `apps/mobile/src/client.ts`)
- Mobile sync client → SQLite store: persists locally (evidence: `apps/mobile/src/client.ts`)
- Fastify API → JWT verification: verifies identity (evidence: `apps/api/src/app.ts`)
- Fastify API → Membership and scope: runs in scope (evidence: `apps/api/src/app.ts`)
- Fastify API → Job handlers: dispatches jobs (evidence: `apps/api/src/app.ts`)
- Fastify API → Expense handlers: dispatches expenses (evidence: `apps/api/src/app.ts`)
- Membership and scope → Database adapter: queries (evidence: `apps/api/src/context.ts`)
- Job handlers → Database adapter: queries (evidence: `apps/api/src/jobs.ts`)
- Expense handlers → Database adapter: queries (evidence: `apps/api/src/expenses.ts`)
- Fastify API → Operations handlers: dispatches operations (evidence: `apps/api/src/app.ts`)
- Operations handlers → Database adapter: queries (evidence: `apps/api/src/operations.ts`)
- Database adapter → PostgreSQL: queries (evidence: `apps/api/src/database.ts`)
- Domain commands → Business records: uses contracts (evidence: `packages/core/src/operations/commands.ts`)
- Domain commands → CRM and intake: uses intake rules (evidence: `packages/core/src/operations/commands.ts`)
- Domain commands → Production workflow: uses production rules (evidence: `packages/core/src/operations/commands.ts`)
- Domain commands → Automations: runs automation rules (evidence: `packages/core/src/operations/commands.ts`)
- Domain commands → Teams and queues: uses queue rules (evidence: `packages/core/src/operations/commands.ts`)
- Domain commands → Money calculations: uses calculations (evidence: `packages/core/src/operations/commands.ts`)
- Browser local store → Domain commands: executes commands (evidence: `apps/web/src/operations/client.ts`)
- Production workflow → Money calculations: uses calculations (evidence: `packages/core/src/operations/production.ts`)
- Automations → Production workflow: reads orders (evidence: `packages/core/src/operations/automations.ts`)
- Automations → Teams and queues: checks queues (evidence: `packages/core/src/operations/automations.ts`)
- Business user → Time tracking: records work
