# kauangabrielcardososilva7890-afk/teste architecture

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

- Interactive diagram: https://gitdiagram.com/kauangabrielcardososilva7890-afk/teste
- Repository: https://github.com/kauangabrielcardososilva7890-afk/teste

## Overview

Digicopy is a desktop business-management system for sales, rentals, printer outsourcing, customer records, and finance. The main user workflow is operating the ERP through its application UI and managing domain records; the excerpts show customer CRUD and sales/quote views, but not the full navigation or save-to-storage path. The repository also contains automation patches, local/cloud synchronization, and Firebird integration. Several subsystems are represented by patch filenames and headers rather than inspected implementation, so uncertain connections are omitted; the cloud and Firebird paths are shown only where excerpts support them.

Main entry points: [`app.js`](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/app.js) (ERP application), [`main.js`](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/main.js) (Electron runtime), [`cloudflare-worker/src/index.js`](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/cloudflare-worker/src/index.js) (Cloud API), [`vendas_patch.js`](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/vendas_patch.js) (Sales and orders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop and local data"]
  node_ui["ERP application<br/>[app.js]"]
  node_desktop_runtime["Electron runtime<br/>[main.js]"]
  node_local_store[("Local persistence")]
  node_firebird[("Firebird access<br/>[main.js]")]
end

subgraph group_operations["Business operations"]
  node_customer_records["Customer records<br/>[clientes_patch.js]"]
  node_sales_orders["Sales and orders<br/>[vendas_patch.js]"]
  node_quotes_receipts["Quotes and receipts<br/>[notinha_patch.js]"]
  node_rental_contracts["Rental contracts"]
  node_service_calls["Service calls"]
  node_finance_inventory["Finance and stock"]
end

subgraph group_automation["Operational automation"]
  node_business_automation["Business automations"]
  node_sales_automation["Sales automations"]
end

subgraph group_cloud["Synchronization and cloud"]
  node_local_sync["Legacy cloud sync<br/>[sync_client.js]"]
  node_firebase_transport["Firebase transport<br/>[firebase_client.js]"]
  node_incremental_sync["Incremental sync engine"]
  node_cloud_api["Cloud API<br/>[index.js]"]
  node_cloud_db[("D1 database")]
end

node_user(("ERP user"))

node_user -->|"uses"| node_ui
node_ui -.->|"manages customers"| node_customer_records
node_ui -.->|"manages sales"| node_sales_orders
node_ui -.->|"views quotes"| node_quotes_receipts
node_ui -.->|"requests Firebird"| node_desktop_runtime
node_ui -->|"extracts data"| node_firebird
node_desktop_runtime -->|"queries"| node_firebird
node_ui -.->|"persists data"| node_local_store
node_business_automation -.->|"automates operations"| node_finance_inventory
node_sales_automation -.->|"supports sales"| node_sales_orders
node_local_sync -->|"uses transport"| node_firebase_transport
node_incremental_sync -.->|"synchronizes with"| node_cloud_api
node_cloud_api -->|"reads and writes"| node_cloud_db

click node_ui "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/app.js"
click node_desktop_runtime "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/main.js"
click node_local_store "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/indexeddb_persistence_patch.js"
click node_firebird "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/main.js"
click node_customer_records "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/clientes_patch.js"
click node_sales_orders "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/vendas_patch.js"
click node_quotes_receipts "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/notinha_patch.js"
click node_rental_contracts "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/locacao_contratos_patch.js"
click node_service_calls "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/locacao_chamados_fix_patch.js"
click node_finance_inventory "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/automacoes_financeiro_estoque_patch.js"
click node_business_automation "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/automacoes_procedures_operacionais_patch.js"
click node_sales_automation "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/automacoes_vendas_fiscal_auxiliares_patch.js"
click node_local_sync "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/sync_client.js"
click node_firebase_transport "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/firebase_client.js"
click node_incremental_sync "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/cloudflare_data_sync_patch.js"
click node_cloud_api "https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/cloudflare-worker/src/index.js"

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_ui,node_desktop_runtime,node_local_store,node_firebird,node_user toneBlue
class node_customer_records,node_sales_orders,node_quotes_receipts,node_rental_contracts,node_service_calls,node_finance_inventory toneAmber
class node_business_automation,node_sales_automation toneMint
class node_local_sync,node_firebase_transport,node_incremental_sync,node_cloud_api,node_cloud_db toneRose
```

## Components

### Desktop and local data

- [ERP application](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/app.js): `app.js`
- [Electron runtime](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/main.js): `main.js`
- [Local persistence](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/indexeddb_persistence_patch.js): `indexeddb_persistence_patch.js`
- [Firebird access](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/main.js): `main.js`

### Business operations

- [Customer records](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/clientes_patch.js): `clientes_patch.js`
- [Sales and orders](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/vendas_patch.js): `vendas_patch.js`
- [Quotes and receipts](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/notinha_patch.js): `notinha_patch.js`
- [Rental contracts](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/locacao_contratos_patch.js): `locacao_contratos_patch.js`
- [Service calls](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/locacao_chamados_fix_patch.js): `locacao_chamados_fix_patch.js`
- [Finance and stock](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/automacoes_financeiro_estoque_patch.js): `automacoes_financeiro_estoque_patch.js`

### Operational automation

- [Business automations](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/automacoes_procedures_operacionais_patch.js): `automacoes_procedures_operacionais_patch.js`
- [Sales automations](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/automacoes_vendas_fiscal_auxiliares_patch.js): `automacoes_vendas_fiscal_auxiliares_patch.js`

### Synchronization and cloud

- [Legacy cloud sync](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/sync_client.js): `sync_client.js`
- [Firebase transport](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/firebase_client.js): `firebase_client.js`
- [Incremental sync engine](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/cloudflare_data_sync_patch.js): `cloudflare_data_sync_patch.js`
- [Cloud API](https://github.com/kauangabrielcardososilva7890-afk/teste/blob/main/cloudflare-worker/src/index.js): `cloudflare-worker/src/index.js`
- **D1 database**

### Other components

- **ERP user**

## Connections

- ERP user → ERP application: uses (evidence: `app.js`)
- ERP application → Customer records: manages customers
- ERP application → Sales and orders: manages sales
- ERP application → Quotes and receipts: views quotes
- ERP application → Electron runtime: requests Firebird
- ERP application → Firebird access: extracts data (evidence: `app.js`)
- Electron runtime → Firebird access: queries (evidence: `main.js`)
- ERP application → Local persistence: persists data
- Business automations → Finance and stock: automates operations
- Sales automations → Sales and orders: supports sales
- Legacy cloud sync → Firebase transport: uses transport (evidence: `sync_client.js`)
- Incremental sync engine → Cloud API: synchronizes with
- Cloud API → D1 database: reads and writes (evidence: `cloudflare-worker/src/index.js`)
