# iqbalussain/bookit architecture

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

- Interactive diagram: https://gitdiagram.com/iqbalussain/bookit
- Repository: https://github.com/iqbalussain/bookit

## Overview

BookIt is an invoice and accounting application with a React interface and Electron desktop runtime. Users manage parties and items, create sales or purchase documents, record payments and vouchers, and review accounting reports. The app routes users to feature pages; shared application state handles accounting operations and local or remote collections. The README documents SQLite storage and backup/restore, while the tree also shows Electron and server components. Some capabilities are represented from README/tree evidence because their implementation was not sampled; unsupported internal wiring is omitted.

Main entry points: [`src/contexts/AppContext.tsx`](https://github.com/iqbalussain/bookit/blob/main/src/contexts/AppContext.tsx) (Application state), [`src/App.tsx`](https://github.com/iqbalussain/bookit/blob/main/src/App.tsx) (App routing), [`src/pages/QuotationForm.tsx`](https://github.com/iqbalussain/bookit/blob/main/src/pages/QuotationForm.tsx) (Quotations), [`src/pages/InvoiceForm.tsx`](https://github.com/iqbalussain/bookit/blob/main/src/pages/InvoiceForm.tsx) (Sales invoices)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Application experience"]
  node_router["App routing<br/>[App.tsx]"]
  node_layout["App layout<br/>[AppLayout.tsx]"]
  node_ui["Shared UI components"]
end

subgraph group_documents["Business documents"]
  node_parties["Customer/vendor management<br/>[ClientsList.tsx]"]
  node_items["Item selection<br/>[ItemPicker.tsx]"]
  node_quotes["Quotations<br/>[QuotationForm.tsx]"]
  node_invoices["Sales invoices<br/>[InvoiceForm.tsx]"]
  node_purchases["Purchase invoices"]
  node_payments["Payments and receipts<br/>[PaymentForm.tsx]"]
end

subgraph group_accounting["Accounting and reports"]
  node_vouchers["Vouchers"]
  node_chart["Chart of accounts"]
  node_reports["Financial reports"]
end

subgraph group_state["State and persistence"]
  node_context["Application state<br/>[AppContext.tsx]"]
  node_posting["Journal posting<br/>[postingEngine.ts]"]
  node_accountinglib["Balance calculations<br/>[accounting.ts]"]
  node_local[("Local collections<br/>[useLocalStorage.ts]")]
  node_remote["Remote collections"]
  node_api["Remote API client<br/>[apiClient.ts]"]
  node_backup["Backup and restore<br/>[BackupRestore.tsx]"]
end

subgraph group_runtime["Desktop and services"]
  node_sqlite[("SQLite database<br/>[server.js]")]
  node_electron["Electron runtime<br/>[main.cjs]"]
end

node_user(("BookIt user"))

node_user -->|"uses"| node_router
node_router -->|"wraps routes"| node_layout
node_router -->|"routes to"| node_invoices
node_router -->|"routes to"| node_quotes
node_invoices -->|"uses state"| node_context
node_quotes -->|"uses state"| node_context
node_parties -->|"uses state"| node_context
node_quotes -->|"uses picker"| node_items
node_context -->|"builds entries"| node_posting
node_context -->|"checks balances"| node_accountinglib
node_context -->|"persists collections"| node_local
node_context -->|"uses collections"| node_remote
node_remote -->|"calls API"| node_api
node_invoices -->|"renders controls"| node_ui
node_user -.->|"stores business data"| node_sqlite
node_user -.->|"runs desktop app"| node_electron

click node_router "https://github.com/iqbalussain/bookit/blob/main/src/App.tsx"
click node_layout "https://github.com/iqbalussain/bookit/blob/main/src/components/layout/AppLayout.tsx"
click node_parties "https://github.com/iqbalussain/bookit/blob/main/src/pages/ClientsList.tsx"
click node_items "https://github.com/iqbalussain/bookit/blob/main/src/components/ItemPicker.tsx"
click node_quotes "https://github.com/iqbalussain/bookit/blob/main/src/pages/QuotationForm.tsx"
click node_invoices "https://github.com/iqbalussain/bookit/blob/main/src/pages/InvoiceForm.tsx"
click node_purchases "https://github.com/iqbalussain/bookit/blob/main/src/pages/PurchaseInvoiceForm.tsx"
click node_payments "https://github.com/iqbalussain/bookit/blob/main/src/pages/PaymentForm.tsx"
click node_vouchers "https://github.com/iqbalussain/bookit/blob/main/src/pages/VoucherDashboard.tsx"
click node_chart "https://github.com/iqbalussain/bookit/blob/main/src/pages/ChartOfAccounts.tsx"
click node_reports "https://github.com/iqbalussain/bookit/tree/main/src/pages/reports"
click node_context "https://github.com/iqbalussain/bookit/blob/main/src/contexts/AppContext.tsx"
click node_posting "https://github.com/iqbalussain/bookit/blob/main/src/lib/postingEngine.ts"
click node_accountinglib "https://github.com/iqbalussain/bookit/blob/main/src/lib/accounting.ts"
click node_local "https://github.com/iqbalussain/bookit/blob/main/src/hooks/useLocalStorage.ts"
click node_remote "https://github.com/iqbalussain/bookit/blob/main/src/hooks/useRemoteCollection.ts"
click node_api "https://github.com/iqbalussain/bookit/blob/main/src/lib/apiClient.ts"
click node_backup "https://github.com/iqbalussain/bookit/blob/main/src/components/BackupRestore.tsx"
click node_sqlite "https://github.com/iqbalussain/bookit/blob/main/server/server.js"
click node_electron "https://github.com/iqbalussain/bookit/blob/main/main.cjs"
click node_ui "https://github.com/iqbalussain/bookit/tree/main/src/components/ui"

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_router,node_layout,node_ui,node_user toneBlue
class node_parties,node_items,node_quotes,node_invoices,node_purchases,node_payments toneAmber
class node_vouchers,node_chart,node_reports toneMint
class node_context,node_posting,node_accountinglib,node_local,node_remote,node_api,node_backup toneRose
class node_sqlite,node_electron toneIndigo
```

## Components

### Application experience

- [App routing](https://github.com/iqbalussain/bookit/blob/main/src/App.tsx): `src/App.tsx`
- [App layout](https://github.com/iqbalussain/bookit/blob/main/src/components/layout/AppLayout.tsx): `src/components/layout/AppLayout.tsx`
- [Shared UI components](https://github.com/iqbalussain/bookit/tree/main/src/components/ui): `src/components/ui`

### Business documents

- [Customer/vendor management](https://github.com/iqbalussain/bookit/blob/main/src/pages/ClientsList.tsx): `src/pages/ClientsList.tsx`
- [Item selection](https://github.com/iqbalussain/bookit/blob/main/src/components/ItemPicker.tsx): `src/components/ItemPicker.tsx`
- [Quotations](https://github.com/iqbalussain/bookit/blob/main/src/pages/QuotationForm.tsx): `src/pages/QuotationForm.tsx`
- [Sales invoices](https://github.com/iqbalussain/bookit/blob/main/src/pages/InvoiceForm.tsx): `src/pages/InvoiceForm.tsx`
- [Purchase invoices](https://github.com/iqbalussain/bookit/blob/main/src/pages/PurchaseInvoiceForm.tsx): `src/pages/PurchaseInvoiceForm.tsx`
- [Payments and receipts](https://github.com/iqbalussain/bookit/blob/main/src/pages/PaymentForm.tsx): `src/pages/PaymentForm.tsx`

### Accounting and reports

- [Vouchers](https://github.com/iqbalussain/bookit/blob/main/src/pages/VoucherDashboard.tsx): `src/pages/VoucherDashboard.tsx`
- [Chart of accounts](https://github.com/iqbalussain/bookit/blob/main/src/pages/ChartOfAccounts.tsx): `src/pages/ChartOfAccounts.tsx`
- [Financial reports](https://github.com/iqbalussain/bookit/tree/main/src/pages/reports): `src/pages/reports`

### State and persistence

- [Application state](https://github.com/iqbalussain/bookit/blob/main/src/contexts/AppContext.tsx): `src/contexts/AppContext.tsx`
- [Journal posting](https://github.com/iqbalussain/bookit/blob/main/src/lib/postingEngine.ts): `src/lib/postingEngine.ts`
- [Balance calculations](https://github.com/iqbalussain/bookit/blob/main/src/lib/accounting.ts): `src/lib/accounting.ts`
- [Local collections](https://github.com/iqbalussain/bookit/blob/main/src/hooks/useLocalStorage.ts): `src/hooks/useLocalStorage.ts`
- [Remote collections](https://github.com/iqbalussain/bookit/blob/main/src/hooks/useRemoteCollection.ts): `src/hooks/useRemoteCollection.ts`
- [Remote API client](https://github.com/iqbalussain/bookit/blob/main/src/lib/apiClient.ts): `src/lib/apiClient.ts`
- [Backup and restore](https://github.com/iqbalussain/bookit/blob/main/src/components/BackupRestore.tsx): `src/components/BackupRestore.tsx`

### Desktop and services

- [SQLite database](https://github.com/iqbalussain/bookit/blob/main/server/server.js): `server/server.js`
- [Electron runtime](https://github.com/iqbalussain/bookit/blob/main/main.cjs): `main.cjs`

### Other components

- **BookIt user**

## Connections

- BookIt user → App routing: uses (evidence: `src/App.tsx`)
- App routing → App layout: wraps routes (evidence: `src/App.tsx`)
- App routing → Sales invoices: routes to (evidence: `src/App.tsx`)
- App routing → Quotations: routes to (evidence: `src/App.tsx`)
- Sales invoices → Application state: uses state (evidence: `src/pages/InvoiceForm.tsx`)
- Quotations → Application state: uses state (evidence: `src/pages/QuotationForm.tsx`)
- Customer/vendor management → Application state: uses state (evidence: `src/pages/ClientsList.tsx`)
- Quotations → Item selection: uses picker (evidence: `src/pages/QuotationForm.tsx`)
- Application state → Journal posting: builds entries (evidence: `src/contexts/AppContext.tsx`)
- Application state → Balance calculations: checks balances (evidence: `src/contexts/AppContext.tsx`)
- Application state → Local collections: persists collections (evidence: `src/contexts/AppContext.tsx`)
- Application state → Remote collections: uses collections (evidence: `src/contexts/AppContext.tsx`)
- Remote collections → Remote API client: calls API (evidence: `src/hooks/useRemoteCollection.ts`)
- Sales invoices → Shared UI components: renders controls (evidence: `src/pages/InvoiceForm.tsx`)
- BookIt user → SQLite database: stores business data (evidence: `README.md`)
- BookIt user → Electron runtime: runs desktop app (evidence: `README.md`)
