# wakhungu3000/rentalmanagement architecture

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

- Interactive diagram: https://gitdiagram.com/wakhungu3000/rentalmanagement
- Repository: https://github.com/wakhungu3000/rentalmanagement

## Overview

Nyumba Ledger is a rental-property management application: owners manage houses and tenants, issue invoices, confirm payments, and oversee maintenance; tenants view their own records, report payments, and submit maintenance requests. The Spring web controllers route requests into services, which enforce domain rules and use repositories for persistence; snapshots assemble role-scoped data for the browser. The README documents authentication, MySQL persistence, and the product capabilities. Several feature implementations and browser scripts were not sampled, so their internal links are omitted or marked unverified.

Main entry points: [`src/main/java/com/nyumba/ledger/repo`](https://github.com/wakhungu3000/rentalmanagement/tree/main/src/main/java/com/nyumba/ledger/repo) (JPA repositories), [`src/main/resources/static/js`](https://github.com/wakhungu3000/rentalmanagement/tree/main/src/main/resources/static/js) (Web pages), [`src/main/java/com/nyumba/ledger/web/BillingController.java`](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/web/BillingController.java) (Billing API), [`src/main/java/com/nyumba/ledger/service/CurrentUserService.java`](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/CurrentUserService.java) (Current user)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and access"]
  node_webui["Web pages"]
  node_security["Login and roles"]
  node_auth["Authentication API"]
  node_current["Current user"]
  node_snapshot_api["Snapshot API"]
  node_snapshot["Role-scoped snapshot"]
  node_mapper["Response mapping<br/>[Mapper.java]"]
  node_requests["Validated requests<br/>[Requests.java]"]
  node_dtos["Response DTOs<br/>[Dtos.java]"]
end

subgraph group_rental["Rental operations"]
  node_house_api["House API"]
  node_house_service["House management<br/>[HouseService.java]"]
  node_tenant_api["Tenant API"]
  node_tenant_service["Tenant management<br/>[TenantService.java]"]
  node_maintenance_api["Maintenance API"]
  node_maintenance["Maintenance requests"]
end

subgraph group_finance["Billing and payments"]
  node_billing_api["Billing API"]
  node_billing["Invoice and payment rules"]
  node_notifications["Invoice notifications"]
end

subgraph group_persistence["Domain and persistence"]
  node_models["Rental entities"]
  node_repositories["JPA repositories"]
  node_mysql[("MySQL database")]
end

node_browser(("Owner / tenant"))

node_browser -->|"uses"| node_webui
node_webui -.->|"signs in"| node_auth
node_webui -.->|"manages houses"| node_house_api
node_webui -.->|"manages tenants"| node_tenant_api
node_webui -.->|"handles billing"| node_billing_api
node_webui -.->|"reports issues"| node_maintenance_api
node_webui -.->|"loads records"| node_snapshot_api
node_security -->|"secures"| node_auth
node_auth -->|"identifies user"| node_current
node_current -->|"looks up account"| node_repositories
node_snapshot_api -->|"identifies user"| node_current
node_snapshot_api -->|"loads snapshot"| node_snapshot
node_snapshot -->|"reads records"| node_repositories
node_snapshot -->|"maps records"| node_mapper
node_house_api -->|"delegates"| node_house_service
node_tenant_api -->|"delegates"| node_tenant_service
node_maintenance_api -->|"delegates"| node_maintenance
node_billing_api -->|"delegates"| node_billing
node_billing_api -->|"identifies payer"| node_current
node_billing -->|"notifies invoice"| node_notifications
node_billing -->|"reads and writes"| node_repositories
node_tenant_service -->|"creates tenant login"| node_repositories
node_house_service -->|"reads and writes"| node_repositories
node_maintenance -->|"persists requests"| node_repositories
node_billing_api -->|"maps responses"| node_mapper
node_mapper -->|"builds response shapes"| node_dtos
node_billing_api -->|"accepts input"| node_requests
node_repositories -->|"stores entities"| node_models
node_repositories -->|"persists data"| node_mysql

click node_webui "https://github.com/wakhungu3000/rentalmanagement/tree/main/src/main/resources/static/js"
click node_security "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/config/SecurityConfig.java"
click node_auth "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/web/AuthController.java"
click node_current "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/CurrentUserService.java"
click node_snapshot_api "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/web/SnapshotController.java"
click node_snapshot "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/SnapshotService.java"
click node_house_api "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/web/HouseController.java"
click node_house_service "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/HouseService.java"
click node_tenant_api "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/web/TenantController.java"
click node_tenant_service "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/TenantService.java"
click node_maintenance_api "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/web/MaintenanceController.java"
click node_maintenance "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/MaintenanceService.java"
click node_billing_api "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/web/BillingController.java"
click node_billing "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/BillingService.java"
click node_notifications "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/NotificationService.java"
click node_mapper "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/Mapper.java"
click node_requests "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/dto/Requests.java"
click node_dtos "https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/dto/Dtos.java"
click node_models "https://github.com/wakhungu3000/rentalmanagement/tree/main/src/main/java/com/nyumba/ledger/domain"
click node_repositories "https://github.com/wakhungu3000/rentalmanagement/tree/main/src/main/java/com/nyumba/ledger/repo"

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_webui,node_security,node_auth,node_current,node_snapshot_api,node_snapshot,node_mapper,node_requests,node_dtos toneBlue
class node_house_api,node_house_service,node_tenant_api,node_tenant_service,node_maintenance_api,node_maintenance toneAmber
class node_billing_api,node_billing,node_notifications toneMint
class node_models,node_repositories,node_mysql toneRose
class node_browser toneIndigo
```

## Components

### Web and access

- [Web pages](https://github.com/wakhungu3000/rentalmanagement/tree/main/src/main/resources/static/js): `src/main/resources/static/js`
- [Login and roles](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/config/SecurityConfig.java): `src/main/java/com/nyumba/ledger/config/SecurityConfig.java`
- [Authentication API](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/web/AuthController.java): `src/main/java/com/nyumba/ledger/web/AuthController.java`
- [Current user](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/CurrentUserService.java): `src/main/java/com/nyumba/ledger/service/CurrentUserService.java`
- [Snapshot API](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/web/SnapshotController.java): `src/main/java/com/nyumba/ledger/web/SnapshotController.java`
- [Role-scoped snapshot](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/SnapshotService.java): `src/main/java/com/nyumba/ledger/service/SnapshotService.java`
- [Response mapping](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/Mapper.java): `src/main/java/com/nyumba/ledger/service/Mapper.java`
- [Validated requests](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/dto/Requests.java): `src/main/java/com/nyumba/ledger/dto/Requests.java`
- [Response DTOs](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/dto/Dtos.java): `src/main/java/com/nyumba/ledger/dto/Dtos.java`

### Rental operations

- [House API](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/web/HouseController.java): `src/main/java/com/nyumba/ledger/web/HouseController.java`
- [House management](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/HouseService.java): `src/main/java/com/nyumba/ledger/service/HouseService.java`
- [Tenant API](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/web/TenantController.java): `src/main/java/com/nyumba/ledger/web/TenantController.java`
- [Tenant management](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/TenantService.java): `src/main/java/com/nyumba/ledger/service/TenantService.java`
- [Maintenance API](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/web/MaintenanceController.java): `src/main/java/com/nyumba/ledger/web/MaintenanceController.java`
- [Maintenance requests](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/MaintenanceService.java): `src/main/java/com/nyumba/ledger/service/MaintenanceService.java`

### Billing and payments

- [Billing API](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/web/BillingController.java): `src/main/java/com/nyumba/ledger/web/BillingController.java`
- [Invoice and payment rules](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/BillingService.java): `src/main/java/com/nyumba/ledger/service/BillingService.java`
- [Invoice notifications](https://github.com/wakhungu3000/rentalmanagement/blob/main/src/main/java/com/nyumba/ledger/service/NotificationService.java): `src/main/java/com/nyumba/ledger/service/NotificationService.java`

### Domain and persistence

- [Rental entities](https://github.com/wakhungu3000/rentalmanagement/tree/main/src/main/java/com/nyumba/ledger/domain): `src/main/java/com/nyumba/ledger/domain`
- [JPA repositories](https://github.com/wakhungu3000/rentalmanagement/tree/main/src/main/java/com/nyumba/ledger/repo): `src/main/java/com/nyumba/ledger/repo`
- **MySQL database**

### Other components

- **Owner / tenant**

## Connections

- Owner / tenant → Web pages: uses
- Web pages → Authentication API: signs in
- Web pages → House API: manages houses
- Web pages → Tenant API: manages tenants
- Web pages → Billing API: handles billing
- Web pages → Maintenance API: reports issues
- Web pages → Snapshot API: loads records
- Login and roles → Authentication API: secures
- Authentication API → Current user: identifies user (evidence: `src/main/java/com/nyumba/ledger/web/AuthController.java`)
- Current user → JPA repositories: looks up account (evidence: `src/main/java/com/nyumba/ledger/service/CurrentUserService.java`)
- Snapshot API → Current user: identifies user (evidence: `src/main/java/com/nyumba/ledger/web/SnapshotController.java`)
- Snapshot API → Role-scoped snapshot: loads snapshot (evidence: `src/main/java/com/nyumba/ledger/web/SnapshotController.java`)
- Role-scoped snapshot → JPA repositories: reads records (evidence: `src/main/java/com/nyumba/ledger/service/SnapshotService.java`)
- Role-scoped snapshot → Response mapping: maps records (evidence: `src/main/java/com/nyumba/ledger/service/SnapshotService.java`)
- House API → House management: delegates (evidence: `src/main/java/com/nyumba/ledger/web/HouseController.java`)
- Tenant API → Tenant management: delegates (evidence: `src/main/java/com/nyumba/ledger/web/TenantController.java`)
- Maintenance API → Maintenance requests: delegates (evidence: `src/main/java/com/nyumba/ledger/web/MaintenanceController.java`)
- Billing API → Invoice and payment rules: delegates (evidence: `src/main/java/com/nyumba/ledger/web/BillingController.java`)
- Billing API → Current user: identifies payer (evidence: `src/main/java/com/nyumba/ledger/web/BillingController.java`)
- Invoice and payment rules → Invoice notifications: notifies invoice (evidence: `src/main/java/com/nyumba/ledger/service/BillingService.java`)
- Invoice and payment rules → JPA repositories: reads and writes (evidence: `src/main/java/com/nyumba/ledger/service/BillingService.java`)
- Tenant management → JPA repositories: creates tenant login (evidence: `src/main/java/com/nyumba/ledger/service/TenantService.java`)
- House management → JPA repositories: reads and writes (evidence: `src/main/java/com/nyumba/ledger/service/HouseService.java`)
- Maintenance requests → JPA repositories: persists requests (evidence: `src/main/java/com/nyumba/ledger/service/MaintenanceService.java`)
- Billing API → Response mapping: maps responses (evidence: `src/main/java/com/nyumba/ledger/web/BillingController.java`)
- Response mapping → Response DTOs: builds response shapes (evidence: `src/main/java/com/nyumba/ledger/service/Mapper.java`)
- Billing API → Validated requests: accepts input (evidence: `src/main/java/com/nyumba/ledger/web/BillingController.java`)
- JPA repositories → Rental entities: stores entities (evidence: `src/main/java/com/nyumba/ledger/repo/TenantRepository.java`)
- JPA repositories → MySQL database: persists data
