# raktim94/rechvix architecture

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

- Interactive diagram: https://gitdiagram.com/raktim94/rechvix
- Repository: https://github.com/raktim94/rechvix

## Overview

Rechvix is a self-hosted ERP for invoicing, inventory, purchasing, accounting and tax preparation. A typical workflow starts with a user maintaining products and customers, then creating and finalizing a sale; the application records supported stock, tax and accounting effects and exposes reports or accountant exports. The web app uses a typed REST client, while the phone app can save sales locally and synchronize them to a server. The README documents many additional opt-in business capabilities. Some server wiring is unsampled, so those relationships are shown only where documented.

Main entry points: [`apps/server/main.go`](https://github.com/raktim94/rechvix/blob/main/apps/server/main.go) (REST server), [`internal/modules/sales/app/service.go`](https://github.com/raktim94/rechvix/blob/main/internal/modules/sales/app/service.go) (Sales and invoices), [`apps/mobile/src/state/app.tsx`](https://github.com/raktim94/rechvix/blob/main/apps/mobile/src/state/app.tsx) (Mobile state), [`apps/mobile/src/sync/engine.ts`](https://github.com/raktim94/rechvix/blob/main/apps/mobile/src/sync/engine.ts) (Sync engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["Web workspace<br/>[router.tsx]"]
  node_webapi["Web API client<br/>[api-client.ts]"]
end

subgraph group_mobile["Mobile application"]
  node_mobileapp["Mobile app<br/>[App.tsx]"]
  node_mobilecontext["Mobile state<br/>[app.tsx]"]
  node_localdb[("Offline records<br/>[repo.ts]")]
  node_sync["Sync engine<br/>[engine.ts]"]
end

subgraph group_business["Business services"]
  node_identity["Identity and access<br/>[handlers.go]"]
  node_organisation["Organisation setup<br/>[service.go]"]
  node_catalogue["Catalogue<br/>[service.go]"]
  node_sales["Sales and invoices<br/>[service.go]"]
  node_inventory["Inventory<br/>[service.go]"]
  node_purchases["Purchasing<br/>[service.go]"]
  node_accounting["Accounting<br/>[service.go]"]
  node_tax["Tax preparation<br/>[engine.go]"]
  node_reporting["Reports and exports<br/>[service.go]"]
  node_crmservice["CRM and field service<br/>[crm.go]"]
  node_channels["Business extensions<br/>[service.go]"]
end

subgraph group_platform["Platform and integrations"]
  node_server["REST server<br/>[main.go]"]
  node_postgres[("PostgreSQL<br/>[database.go]")]
end

node_user(("Business user"))
node_external{{"Optional providers"}}

node_user -->|"uses"| node_webapp
node_webapp -->|"requests data"| node_webapi
node_webapi -->|"calls REST API"| node_server
node_user -->|"uses"| node_mobileapp
node_mobileapp -->|"renders through"| node_mobilecontext
node_mobilecontext -->|"stores records"| node_localdb
node_mobilecontext -->|"runs synchronization"| node_sync
node_sync -->|"reads and updates"| node_localdb
node_sync -.->|"synchronizes sales"| node_server
node_server -.->|"serves identity APIs"| node_identity
node_server -.->|"serves organisation APIs"| node_organisation
node_server -.->|"serves catalogue APIs"| node_catalogue
node_server -.->|"serves sales APIs"| node_sales
node_server -.->|"serves inventory APIs"| node_inventory
node_server -.->|"serves purchase APIs"| node_purchases
node_server -.->|"serves accounting APIs"| node_accounting
node_server -.->|"serves tax APIs"| node_tax
node_server -.->|"serves reporting APIs"| node_reporting
node_server -.->|"serves CRM workflows"| node_crmservice
node_server -.->|"serves opt-in capabilities"| node_channels
node_server -.->|"persists business records"| node_postgres
node_sales -.->|"posts stock effects"| node_inventory
node_sales -.->|"posts accounting entries"| node_accounting
node_sales -.->|"records tax effects"| node_tax
node_accounting -.->|"feeds reports"| node_reporting
node_tax -.->|"prepares exports"| node_reporting
node_channels -.->|"integrates optionally"| node_external

click node_webapp "https://github.com/raktim94/rechvix/blob/main/apps/web/src/router.tsx"
click node_webapi "https://github.com/raktim94/rechvix/blob/main/apps/web/src/lib/api-client.ts"
click node_mobileapp "https://github.com/raktim94/rechvix/blob/main/apps/mobile/App.tsx"
click node_mobilecontext "https://github.com/raktim94/rechvix/blob/main/apps/mobile/src/state/app.tsx"
click node_localdb "https://github.com/raktim94/rechvix/blob/main/apps/mobile/src/db/repo.ts"
click node_sync "https://github.com/raktim94/rechvix/blob/main/apps/mobile/src/sync/engine.ts"
click node_server "https://github.com/raktim94/rechvix/blob/main/apps/server/main.go"
click node_identity "https://github.com/raktim94/rechvix/blob/main/internal/modules/identity/httpapi/handlers.go"
click node_organisation "https://github.com/raktim94/rechvix/blob/main/internal/modules/organisation/app/service.go"
click node_catalogue "https://github.com/raktim94/rechvix/blob/main/internal/modules/catalogue/app/service.go"
click node_sales "https://github.com/raktim94/rechvix/blob/main/internal/modules/sales/app/service.go"
click node_inventory "https://github.com/raktim94/rechvix/blob/main/internal/modules/inventory/app/service.go"
click node_purchases "https://github.com/raktim94/rechvix/blob/main/internal/modules/purchases/app/service.go"
click node_accounting "https://github.com/raktim94/rechvix/blob/main/internal/modules/accounting/app/service.go"
click node_tax "https://github.com/raktim94/rechvix/blob/main/internal/modules/gstindia/engine.go"
click node_reporting "https://github.com/raktim94/rechvix/blob/main/internal/modules/reporting/app/service.go"
click node_crmservice "https://github.com/raktim94/rechvix/blob/main/internal/modules/crm/crm.go"
click node_channels "https://github.com/raktim94/rechvix/blob/main/internal/modules/onlinepay/service.go"
click node_postgres "https://github.com/raktim94/rechvix/blob/main/internal/platform/database/database.go"

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_webapp,node_webapi,node_user toneBlue
class node_mobileapp,node_mobilecontext,node_localdb,node_sync toneAmber
class node_identity,node_organisation,node_catalogue,node_sales,node_inventory,node_purchases,node_accounting,node_tax,node_reporting,node_crmservice,node_channels toneMint
class node_server,node_postgres toneRose
class node_external toneIndigo
```

## Components

### Web application

- [Web workspace](https://github.com/raktim94/rechvix/blob/main/apps/web/src/router.tsx): `apps/web/src/router.tsx`
- [Web API client](https://github.com/raktim94/rechvix/blob/main/apps/web/src/lib/api-client.ts): `apps/web/src/lib/api-client.ts`

### Mobile application

- [Mobile app](https://github.com/raktim94/rechvix/blob/main/apps/mobile/App.tsx): `apps/mobile/App.tsx`
- [Mobile state](https://github.com/raktim94/rechvix/blob/main/apps/mobile/src/state/app.tsx): `apps/mobile/src/state/app.tsx`
- [Offline records](https://github.com/raktim94/rechvix/blob/main/apps/mobile/src/db/repo.ts): `apps/mobile/src/db/repo.ts`
- [Sync engine](https://github.com/raktim94/rechvix/blob/main/apps/mobile/src/sync/engine.ts): `apps/mobile/src/sync/engine.ts`

### Business services

- [Identity and access](https://github.com/raktim94/rechvix/blob/main/internal/modules/identity/httpapi/handlers.go): `internal/modules/identity/httpapi/handlers.go`
- [Organisation setup](https://github.com/raktim94/rechvix/blob/main/internal/modules/organisation/app/service.go): `internal/modules/organisation/app/service.go`
- [Catalogue](https://github.com/raktim94/rechvix/blob/main/internal/modules/catalogue/app/service.go): `internal/modules/catalogue/app/service.go`
- [Sales and invoices](https://github.com/raktim94/rechvix/blob/main/internal/modules/sales/app/service.go): `internal/modules/sales/app/service.go`
- [Inventory](https://github.com/raktim94/rechvix/blob/main/internal/modules/inventory/app/service.go): `internal/modules/inventory/app/service.go`
- [Purchasing](https://github.com/raktim94/rechvix/blob/main/internal/modules/purchases/app/service.go): `internal/modules/purchases/app/service.go`
- [Accounting](https://github.com/raktim94/rechvix/blob/main/internal/modules/accounting/app/service.go): `internal/modules/accounting/app/service.go`
- [Tax preparation](https://github.com/raktim94/rechvix/blob/main/internal/modules/gstindia/engine.go): `internal/modules/gstindia/engine.go`
- [Reports and exports](https://github.com/raktim94/rechvix/blob/main/internal/modules/reporting/app/service.go): `internal/modules/reporting/app/service.go`
- [CRM and field service](https://github.com/raktim94/rechvix/blob/main/internal/modules/crm/crm.go): `internal/modules/crm/crm.go`
- [Business extensions](https://github.com/raktim94/rechvix/blob/main/internal/modules/onlinepay/service.go): `internal/modules/onlinepay/service.go`

### Platform and integrations

- [REST server](https://github.com/raktim94/rechvix/blob/main/apps/server/main.go): `apps/server/main.go`
- [PostgreSQL](https://github.com/raktim94/rechvix/blob/main/internal/platform/database/database.go): `internal/platform/database/database.go`

### Other components

- **Business user**
- **Optional providers**

## Connections

- Business user → Web workspace: uses (evidence: `README.md`)
- Web workspace → Web API client: requests data (evidence: `apps/web/src/lib/api-client.ts`)
- Web API client → REST server: calls REST API (evidence: `apps/web/src/lib/api-client.ts`)
- Business user → Mobile app: uses (evidence: `README.md`)
- Mobile app → Mobile state: renders through (evidence: `apps/mobile/App.tsx`)
- Mobile state → Offline records: stores records (evidence: `apps/mobile/src/state/app.tsx`)
- Mobile state → Sync engine: runs synchronization (evidence: `apps/mobile/src/state/app.tsx`)
- Sync engine → Offline records: reads and updates (evidence: `apps/mobile/src/sync/engine.ts`)
- Sync engine → REST server: synchronizes sales
- REST server → Identity and access: serves identity APIs
- REST server → Organisation setup: serves organisation APIs
- REST server → Catalogue: serves catalogue APIs
- REST server → Sales and invoices: serves sales APIs
- REST server → Inventory: serves inventory APIs
- REST server → Purchasing: serves purchase APIs
- REST server → Accounting: serves accounting APIs
- REST server → Tax preparation: serves tax APIs
- REST server → Reports and exports: serves reporting APIs
- REST server → CRM and field service: serves CRM workflows
- REST server → Business extensions: serves opt-in capabilities
- REST server → PostgreSQL: persists business records
- Sales and invoices → Inventory: posts stock effects (evidence: `README.md`)
- Sales and invoices → Accounting: posts accounting entries (evidence: `README.md`)
- Sales and invoices → Tax preparation: records tax effects (evidence: `README.md`)
- Accounting → Reports and exports: feeds reports (evidence: `README.md`)
- Tax preparation → Reports and exports: prepares exports (evidence: `README.md`)
- Business extensions → Optional providers: integrates optionally (evidence: `README.md`)
