# mzaedan/mybon architecture

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

- Interactive diagram: https://gitdiagram.com/mzaedan/mybon
- Repository: https://github.com/mzaedan/mybon

## Overview

MyBon is a web-based debt notebook for managing customers, stock items, credit records (bon), payments, and user access. The main workflow is an administrator using the web app to maintain customers and items, record a bon and its payments, then review the resulting records or dashboard; customer accounts are documented as read-only for their own bons. The graph covers the sampled MVC/service/persistence layers and the major capabilities indicated by the repository tree and source index. Several controllers, dashboard code, and browser scripts were not sampled, so their internal links are omitted.

Main entry points: [`Data/AppDbContext.cs`](https://github.com/mzaedan/mybon/blob/master/Data/AppDbContext.cs) (Application database), [`Controllers/BonController.cs`](https://github.com/mzaedan/mybon/blob/master/Controllers/BonController.cs) (Bon requests), [`Domain/Services/PenggunaService.cs`](https://github.com/mzaedan/mybon/blob/master/Domain/Services/PenggunaService.cs) (Account management), [`Controllers/PelangganController.cs`](https://github.com/mzaedan/mybon/blob/master/Controllers/PelangganController.cs) (Customer requests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_bon_ui["Bon screens"]
  node_barang_ui["Stock screens"]
  node_pelanggan_ui["Customer screens"]
  node_pengguna_ui["User screens"]
  node_auth_ui["Login screen<br/>[login.js]"]
  node_pwa["Offline support<br/>[sw.js]"]
  node_bon_controller["Bon requests<br/>[BonController.cs]"]
  node_barang_controller["Stock requests"]
  node_pelanggan_controller["Customer requests"]
  node_auth_controller["Login requests<br/>[AuthController.cs]"]
end

subgraph group_domain["Business services"]
  node_bon_service["Bon and payments<br/>[BonService.cs]"]
  node_barang_service["Stock management<br/>[BarangService.cs]"]
  node_pelanggan_service["Customer management"]
  node_dashboard_service["Dashboard summaries"]
  node_error_result["Operation results<br/>[ErrorOr.cs]"]
end

subgraph group_identity["Identity and access"]
  node_auth_service["Authentication<br/>[AuthService.cs]"]
  node_pengguna_service["Account management<br/>[PenggunaService.cs]"]
  node_context["Request identity<br/>[Context.cs]"]
end

subgraph group_data["Persistence"]
  node_database[("Application database<br/>[AppDbContext.cs]")]
  node_bon_model["Bon records<br/>[Bon.cs]"]
  node_barang_model["Stock records<br/>[Barang.cs]"]
  node_pelanggan_model["Customer records<br/>[Pelanggan.cs]"]
  node_pengguna_model["User records<br/>[Pengguna.cs]"]
end

node_admin(("Shop administrator"))
node_customer(("Customer"))

node_bon_controller -->|"calls"| node_bon_service
node_barang_controller -->|"calls"| node_barang_service
node_pelanggan_controller -->|"calls"| node_pelanggan_service
node_pelanggan_controller -->|"calls"| node_pengguna_service
node_auth_controller -->|"calls"| node_auth_service
node_auth_controller -->|"calls"| node_pengguna_service
node_bon_service -->|"reads and writes"| node_database
node_barang_service -->|"reads and writes"| node_database
node_auth_service -->|"reads and writes"| node_database
node_pengguna_service -->|"reads and writes"| node_database
node_database -->|"maps"| node_bon_model
node_database -->|"maps"| node_barang_model
node_database -->|"maps"| node_pelanggan_model
node_database -->|"maps"| node_pengguna_model
node_admin -.->|"uses"| node_bon_controller
node_customer -.->|"views own bons"| node_bon_controller

click node_bon_ui "https://github.com/mzaedan/mybon/tree/master/wwwroot/custom/features/bon"
click node_barang_ui "https://github.com/mzaedan/mybon/tree/master/wwwroot/custom/features/barang"
click node_pelanggan_ui "https://github.com/mzaedan/mybon/tree/master/wwwroot/custom/features/pelanggan"
click node_pengguna_ui "https://github.com/mzaedan/mybon/tree/master/wwwroot/custom/features/pengguna"
click node_auth_ui "https://github.com/mzaedan/mybon/blob/master/wwwroot/custom/features/auth/login.js"
click node_pwa "https://github.com/mzaedan/mybon/blob/master/wwwroot/sw.js"
click node_bon_controller "https://github.com/mzaedan/mybon/blob/master/Controllers/BonController.cs"
click node_barang_controller "https://github.com/mzaedan/mybon/blob/master/Controllers/BarangController.cs"
click node_pelanggan_controller "https://github.com/mzaedan/mybon/blob/master/Controllers/PelangganController.cs"
click node_auth_controller "https://github.com/mzaedan/mybon/blob/master/Controllers/AuthController.cs"
click node_bon_service "https://github.com/mzaedan/mybon/blob/master/Domain/Services/BonService.cs"
click node_barang_service "https://github.com/mzaedan/mybon/blob/master/Domain/Services/BarangService.cs"
click node_pelanggan_service "https://github.com/mzaedan/mybon/blob/master/Domain/Services/PelangganService.cs"
click node_dashboard_service "https://github.com/mzaedan/mybon/blob/master/Domain/Services/DashboardService.cs"
click node_auth_service "https://github.com/mzaedan/mybon/blob/master/Domain/Services/AuthService.cs"
click node_pengguna_service "https://github.com/mzaedan/mybon/blob/master/Domain/Services/PenggunaService.cs"
click node_context "https://github.com/mzaedan/mybon/blob/master/Infrastructure/Contexts/Context.cs"
click node_database "https://github.com/mzaedan/mybon/blob/master/Data/AppDbContext.cs"
click node_bon_model "https://github.com/mzaedan/mybon/blob/master/Domain/Entities/Bon.cs"
click node_barang_model "https://github.com/mzaedan/mybon/blob/master/Domain/Entities/Barang.cs"
click node_pelanggan_model "https://github.com/mzaedan/mybon/blob/master/Domain/Entities/Pelanggan.cs"
click node_pengguna_model "https://github.com/mzaedan/mybon/blob/master/Domain/Entities/Pengguna.cs"
click node_error_result "https://github.com/mzaedan/mybon/blob/master/Models/Common/ErrorOr.cs"

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_bon_ui,node_barang_ui,node_pelanggan_ui,node_pengguna_ui,node_auth_ui,node_pwa,node_bon_controller,node_barang_controller,node_pelanggan_controller,node_auth_controller toneBlue
class node_bon_service,node_barang_service,node_pelanggan_service,node_dashboard_service,node_error_result toneAmber
class node_auth_service,node_pengguna_service,node_context toneMint
class node_database,node_bon_model,node_barang_model,node_pelanggan_model,node_pengguna_model toneRose
class node_admin,node_customer toneIndigo
```

## Components

### Web interface

- [Bon screens](https://github.com/mzaedan/mybon/tree/master/wwwroot/custom/features/bon): `wwwroot/custom/features/bon`
- [Stock screens](https://github.com/mzaedan/mybon/tree/master/wwwroot/custom/features/barang): `wwwroot/custom/features/barang`
- [Customer screens](https://github.com/mzaedan/mybon/tree/master/wwwroot/custom/features/pelanggan): `wwwroot/custom/features/pelanggan`
- [User screens](https://github.com/mzaedan/mybon/tree/master/wwwroot/custom/features/pengguna): `wwwroot/custom/features/pengguna`
- [Login screen](https://github.com/mzaedan/mybon/blob/master/wwwroot/custom/features/auth/login.js): `wwwroot/custom/features/auth/login.js`
- [Offline support](https://github.com/mzaedan/mybon/blob/master/wwwroot/sw.js): `wwwroot/sw.js`
- [Bon requests](https://github.com/mzaedan/mybon/blob/master/Controllers/BonController.cs): `Controllers/BonController.cs`
- [Stock requests](https://github.com/mzaedan/mybon/blob/master/Controllers/BarangController.cs): `Controllers/BarangController.cs`
- [Customer requests](https://github.com/mzaedan/mybon/blob/master/Controllers/PelangganController.cs): `Controllers/PelangganController.cs`
- [Login requests](https://github.com/mzaedan/mybon/blob/master/Controllers/AuthController.cs): `Controllers/AuthController.cs`

### Business services

- [Bon and payments](https://github.com/mzaedan/mybon/blob/master/Domain/Services/BonService.cs): `Domain/Services/BonService.cs`
- [Stock management](https://github.com/mzaedan/mybon/blob/master/Domain/Services/BarangService.cs): `Domain/Services/BarangService.cs`
- [Customer management](https://github.com/mzaedan/mybon/blob/master/Domain/Services/PelangganService.cs): `Domain/Services/PelangganService.cs`
- [Dashboard summaries](https://github.com/mzaedan/mybon/blob/master/Domain/Services/DashboardService.cs): `Domain/Services/DashboardService.cs`
- [Operation results](https://github.com/mzaedan/mybon/blob/master/Models/Common/ErrorOr.cs): `Models/Common/ErrorOr.cs`

### Identity and access

- [Authentication](https://github.com/mzaedan/mybon/blob/master/Domain/Services/AuthService.cs): `Domain/Services/AuthService.cs`
- [Account management](https://github.com/mzaedan/mybon/blob/master/Domain/Services/PenggunaService.cs): `Domain/Services/PenggunaService.cs`
- [Request identity](https://github.com/mzaedan/mybon/blob/master/Infrastructure/Contexts/Context.cs): `Infrastructure/Contexts/Context.cs`

### Persistence

- [Application database](https://github.com/mzaedan/mybon/blob/master/Data/AppDbContext.cs): `Data/AppDbContext.cs`
- [Bon records](https://github.com/mzaedan/mybon/blob/master/Domain/Entities/Bon.cs): `Domain/Entities/Bon.cs`
- [Stock records](https://github.com/mzaedan/mybon/blob/master/Domain/Entities/Barang.cs): `Domain/Entities/Barang.cs`
- [Customer records](https://github.com/mzaedan/mybon/blob/master/Domain/Entities/Pelanggan.cs): `Domain/Entities/Pelanggan.cs`
- [User records](https://github.com/mzaedan/mybon/blob/master/Domain/Entities/Pengguna.cs): `Domain/Entities/Pengguna.cs`

### Other components

- **Shop administrator**
- **Customer**

## Connections

- Bon requests → Bon and payments: calls (evidence: `Controllers/BonController.cs`)
- Stock requests → Stock management: calls (evidence: `Controllers/BarangController.cs`)
- Customer requests → Customer management: calls (evidence: `Controllers/PelangganController.cs`)
- Customer requests → Account management: calls (evidence: `Controllers/PelangganController.cs`)
- Login requests → Authentication: calls (evidence: `Controllers/AuthController.cs`)
- Login requests → Account management: calls (evidence: `Controllers/AuthController.cs`)
- Bon and payments → Application database: reads and writes (evidence: `Domain/Services/BonService.cs`)
- Stock management → Application database: reads and writes (evidence: `Domain/Services/BarangService.cs`)
- Authentication → Application database: reads and writes (evidence: `Domain/Services/AuthService.cs`)
- Account management → Application database: reads and writes (evidence: `Domain/Services/PenggunaService.cs`)
- Application database → Bon records: maps (evidence: `Data/AppDbContext.cs`)
- Application database → Stock records: maps (evidence: `Data/AppDbContext.cs`)
- Application database → Customer records: maps (evidence: `Data/AppDbContext.cs`)
- Application database → User records: maps (evidence: `Data/AppDbContext.cs`)
- Shop administrator → Bon requests: uses
- Customer → Bon requests: views own bons
