# sepehrraeisi/zar architecture

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

- Interactive diagram: https://gitdiagram.com/sepehrraeisi/zar
- Repository: https://github.com/sepehrraeisi/zar

## Overview

ZAR+ is a Persian-first operational app for gold and currency work. Users manage people and asset deals, record separate settlements, and explicitly allocate completed or open Toman movements to obligations; the app derives customer operational position rather than persisting balances. The V2 shell also coordinates settlement-owned reminder plans with device notifications, while backup/export and archived-people workflows support data portability and record management. The supplied tree omits the Flutter/Dart application source, so those components have no asserted source path or speculative call wiring. Native permission bridges and the PocketBase migration are visible; production Firebase is documented as disabled.

Main entry points: [`ios/Runner/AppDelegate.swift`](https://github.com/sepehrraeisi/zar/blob/master/ios/Runner/AppDelegate.swift) (iOS permission bridge), [`android/app/src/main/kotlin/com/zarplus/app/MainActivity.kt`](https://github.com/sepehrraeisi/zar/blob/master/android/app/src/main/kotlin/com/zarplus/app/MainActivity.kt) (Permission bridge), [`server/pb_migrations/1758400000_zar_collections.js`](https://github.com/sepehrraeisi/zar/blob/master/server/pb_migrations/1758400000_zar_collections.js) (PocketBase collections)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Operations"]
  node_rtl_app["Persian RTL app"]
  node_people["People &amp; archive"]
  node_deals["Gold/currency deals"]
  node_settlements["Settlements"]
end

subgraph group_obligations["Obligations"]
  node_allocations["Payment allocations"]
  node_position["Customer position"]
end

subgraph group_reminders["Reminders"]
  node_notification_center["Notification Center"]
  node_reminder_plan["Reminder plans"]
  node_native_delivery["Native notifications"]
  node_permission_bridge["Permission bridge<br/>[MainActivity.kt]"]
  node_ios_permission["iOS permission bridge<br/>[AppDelegate.swift]"]
end

subgraph group_portability["Portability"]
  node_backup_export["Backup &amp; CSV export"]
end

subgraph group_persistence["Persistence"]
  node_local_store[("Drift/SQLite store")]
  node_cloud_mapper["Firestore layer"]
  node_pocketbase_schema[("PocketBase collections")]
end

node_operator(("Operator"))
node_device_os(("Device notification OS"))

node_operator -->|"uses"| node_rtl_app
node_rtl_app -->|"manages"| node_people
node_rtl_app -->|"records"| node_deals
node_rtl_app -->|"records"| node_settlements
node_settlements -->|"owns plan"| node_reminder_plan
node_rtl_app -->|"records"| node_allocations
node_allocations -->|"reduce obligations"| node_position
node_deals -->|"create obligations"| node_position
node_rtl_app -->|"opens"| node_notification_center
node_reminder_plan -->|"schedules"| node_native_delivery
node_native_delivery -->|"delivers"| node_device_os
node_rtl_app -->|"queries permission"| node_permission_bridge
node_ios_permission -->|"queries settings"| node_device_os
node_rtl_app -->|"exports/restores"| node_backup_export
node_rtl_app -->|"persists records"| node_local_store
node_rtl_app -.->|"maps domain data"| node_cloud_mapper
node_cloud_mapper -.->|"unspecified"| node_pocketbase_schema

click node_permission_bridge "https://github.com/sepehrraeisi/zar/blob/master/android/app/src/main/kotlin/com/zarplus/app/MainActivity.kt"
click node_ios_permission "https://github.com/sepehrraeisi/zar/blob/master/ios/Runner/AppDelegate.swift"
click node_pocketbase_schema "https://github.com/sepehrraeisi/zar/blob/master/server/pb_migrations/1758400000_zar_collections.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_rtl_app,node_people,node_deals,node_settlements toneBlue
class node_allocations,node_position toneAmber
class node_notification_center,node_reminder_plan,node_native_delivery,node_permission_bridge,node_ios_permission toneMint
class node_backup_export toneRose
class node_local_store,node_cloud_mapper,node_pocketbase_schema,node_operator,node_device_os toneIndigo
```

## Components

### Operations

- **Persian RTL app**
- **People & archive**
- **Gold/currency deals**
- **Settlements**

### Obligations

- **Payment allocations**
- **Customer position**

### Reminders

- **Notification Center**
- **Reminder plans**
- **Native notifications**
- [Permission bridge](https://github.com/sepehrraeisi/zar/blob/master/android/app/src/main/kotlin/com/zarplus/app/MainActivity.kt): `android/app/src/main/kotlin/com/zarplus/app/MainActivity.kt`
- [iOS permission bridge](https://github.com/sepehrraeisi/zar/blob/master/ios/Runner/AppDelegate.swift): `ios/Runner/AppDelegate.swift`

### Portability

- **Backup & CSV export**

### Persistence

- **Drift/SQLite store**
- **Firestore layer**
- [PocketBase collections](https://github.com/sepehrraeisi/zar/blob/master/server/pb_migrations/1758400000_zar_collections.js): `server/pb_migrations/1758400000_zar_collections.js`

### Other components

- **Operator**
- **Device notification OS**

## Connections

- Operator → Persian RTL app: uses
- Persian RTL app → People & archive: manages
- Persian RTL app → Gold/currency deals: records
- Persian RTL app → Settlements: records
- Settlements → Reminder plans: owns plan
- Persian RTL app → Payment allocations: records
- Payment allocations → Customer position: reduce obligations
- Gold/currency deals → Customer position: create obligations
- Persian RTL app → Notification Center: opens
- Reminder plans → Native notifications: schedules
- Native notifications → Device notification OS: delivers
- Persian RTL app → Permission bridge: queries permission
- iOS permission bridge → Device notification OS: queries settings
- Persian RTL app → Backup & CSV export: exports/restores
- Persian RTL app → Drift/SQLite store: persists records
- Persian RTL app → Firestore layer: maps domain data
- Firestore layer → PocketBase collections: unspecified
