# nachy22/creditbook architecture

> Architecture diagram of the GitHub repository nachy22/creditbook, 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/nachy22/creditbook
- Repository: https://github.com/nachy22/creditbook

## Overview

CreditBook is an offline Android credit ledger for small traders. The main workflow is to manage customers, record debts and payments, review balances and history, and check overall debt exposure. Room provides persistent records and balance calculation; a scheduled background check handles overdue-payment reminders. The tree and README identify these capabilities, but no application source was excerpted, so component-level calls and wiring cannot be verified; documented relationships cite the README.

Main entry points: [`app/src/main/java/com/example/creditbook/MainActivity.kt`](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/MainActivity.kt) (Customer list), [`app/src/main/java/com/example/creditbook/data/AppDatabase.kt`](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/data/AppDatabase.kt) (Room database), [`app/src/main/java/com/example/creditbook/ui/CustomerDetailActivity.kt`](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/ui/CustomerDetailActivity.kt) (Customer details), [`app/src/main/java/com/example/work/OverdueCheckWorker.kt`](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/work/OverdueCheckWorker.kt) (Overdue check)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Ledger screens"]
  node_customer_list["Customer list<br/>[MainActivity.kt]"]
  node_customer_form["Add customer"]
  node_customer_details["Customer details"]
  node_entry_form["Debt or payment"]
  node_customer_adapter["Customer rows<br/>[CustomerAdapter.kt]"]
end

subgraph group_data["Credit records"]
  node_repository["Credit repository"]
  node_dao["Credit queries<br/>[CreditDao.kt]"]
  node_database[("Room database<br/>[AppDatabase.kt]")]
  node_entities["Credit records<br/>[Entities.kt]"]
end

subgraph group_reminders["Overdue reminders"]
  node_scheduler["Reminder scheduler"]
  node_overdue_worker["Overdue check"]
  node_notification["Reminder notification"]
end

subgraph group_summary["Business overview"]
  node_debtor_adapter["Debtor rows<br/>[DebtorAdapter.kt]"]
  node_summary_screen["Summary screen<br/>[SummaryActivity.kt]"]
end

node_trader(("Shop trader"))
node_android_notifications["Android notifications"]

node_trader -->|"views records"| node_customer_list
node_customer_list -->|"adds customer"| node_customer_form
node_customer_list -->|"opens history"| node_customer_details
node_customer_list -->|"opens summary"| node_summary_screen
node_customer_details -->|"adds debt or payment"| node_entry_form
node_repository -.->|"stores records"| node_database
node_database -->|"persists records"| node_entities
node_database -->|"calculates balances"| node_dao
node_scheduler -->|"schedules daily check"| node_overdue_worker
node_overdue_worker -->|"shows reminder"| node_notification
node_notification -->|"posts notification"| node_android_notifications

click node_customer_list "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/MainActivity.kt"
click node_customer_form "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/ui/AddCustomerActivity.kt"
click node_customer_details "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/ui/CustomerDetailActivity.kt"
click node_entry_form "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/ui/AddEntryActivity.kt"
click node_customer_adapter "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/ui/CustomerAdapter.kt"
click node_debtor_adapter "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/ui/DebtorAdapter.kt"
click node_summary_screen "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/ui/SummaryActivity.kt"
click node_repository "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/data/CreditRepository.kt"
click node_dao "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/data/CreditDao.kt"
click node_database "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/data/AppDatabase.kt"
click node_entities "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/data/Entities.kt"
click node_scheduler "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/work/ReminderScheduler.kt"
click node_overdue_worker "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/work/OverdueCheckWorker.kt"
click node_notification "https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/work/NotificationHelper.kt"

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_customer_list,node_customer_form,node_customer_details,node_entry_form,node_customer_adapter toneBlue
class node_repository,node_dao,node_database,node_entities toneAmber
class node_scheduler,node_overdue_worker,node_notification toneMint
class node_debtor_adapter,node_summary_screen toneRose
class node_trader,node_android_notifications toneIndigo
```

## Components

### Ledger screens

- [Customer list](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/MainActivity.kt): `app/src/main/java/com/example/creditbook/MainActivity.kt`
- [Add customer](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/ui/AddCustomerActivity.kt): `app/src/main/java/com/example/creditbook/ui/AddCustomerActivity.kt`
- [Customer details](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/ui/CustomerDetailActivity.kt): `app/src/main/java/com/example/creditbook/ui/CustomerDetailActivity.kt`
- [Debt or payment](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/ui/AddEntryActivity.kt): `app/src/main/java/com/example/creditbook/ui/AddEntryActivity.kt`
- [Customer rows](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/ui/CustomerAdapter.kt): `app/src/main/java/com/example/creditbook/ui/CustomerAdapter.kt`

### Credit records

- [Credit repository](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/data/CreditRepository.kt): `app/src/main/java/com/example/creditbook/data/CreditRepository.kt`
- [Credit queries](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/data/CreditDao.kt): `app/src/main/java/com/example/creditbook/data/CreditDao.kt`
- [Room database](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/data/AppDatabase.kt): `app/src/main/java/com/example/creditbook/data/AppDatabase.kt`
- [Credit records](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/data/Entities.kt): `app/src/main/java/com/example/creditbook/data/Entities.kt`

### Overdue reminders

- [Reminder scheduler](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/work/ReminderScheduler.kt): `app/src/main/java/com/example/work/ReminderScheduler.kt`
- [Overdue check](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/work/OverdueCheckWorker.kt): `app/src/main/java/com/example/work/OverdueCheckWorker.kt`
- [Reminder notification](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/work/NotificationHelper.kt): `app/src/main/java/com/example/work/NotificationHelper.kt`

### Business overview

- [Debtor rows](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/ui/DebtorAdapter.kt): `app/src/main/java/com/example/creditbook/ui/DebtorAdapter.kt`
- [Summary screen](https://github.com/nachy22/creditbook/blob/master/app/src/main/java/com/example/creditbook/ui/SummaryActivity.kt): `app/src/main/java/com/example/creditbook/ui/SummaryActivity.kt`

### Other components

- **Shop trader**
- **Android notifications**

## Connections

- Shop trader → Customer list: views records (evidence: `README.md`)
- Customer list → Add customer: adds customer (evidence: `README.md`)
- Customer list → Customer details: opens history (evidence: `README.md`)
- Customer list → Summary screen: opens summary (evidence: `README.md`)
- Customer details → Debt or payment: adds debt or payment (evidence: `README.md`)
- Credit repository → Room database: stores records
- Room database → Credit records: persists records (evidence: `README.md`)
- Room database → Credit queries: calculates balances (evidence: `README.md`)
- Reminder scheduler → Overdue check: schedules daily check (evidence: `README.md`)
- Overdue check → Reminder notification: shows reminder (evidence: `README.md`)
- Reminder notification → Android notifications: posts notification (evidence: `README.md`)
