# archit-d300/enterprise-expense-reimbursement-system architecture

> Architecture diagram of the GitHub repository archit-d300/enterprise-expense-reimbursement-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/archit-d300/enterprise-expense-reimbursement-system
- Repository: https://github.com/archit-d300/enterprise-expense-reimbursement-system

## Overview

#### Purpose and Entry Points
A Java enterprise expense-reimbursement application demonstrating policy-driven claim handling, approval workflows, persistence, notifications, and payment. Execution begins at `src/Main.java`; the central application façade/singleton is `src/singleton/ExpenseManagementSystem.java`.

#### Claim Domain and Expense Creation
Claims are represented by `src/model/ExpenseClaim.java` with concrete expense categories such as `src/model/TravelExpense.java`, `src/model/FoodExpense.java`, and `src/model/AccommodationExpense.java`. Category-specific factories—`src/factory/ExpenseFactory.java`, `src/factory/TravelExpenseFactory.java`, and `src/factory/OfficeExpenseFactory.java`—separate claim construction from workflow logic.

#### User Roles and Policy Selection
Role entities and factories in `src/policy/User.java`, `src/policy/UserFactory.java`, and `src/policy/Manager.java` establish the claimant/approver context. `src/policy/ExpensePolicyFactory.java` selects role-specific policy implementations such as `src/policy/EmployeeExpensePolicy.java` and `src/policy/ExecutiveExpensePolicy.java`. `src/policy/PolicyEvaluator.java` produces `src/policy/PolicyDecision.java`, forming a boundary between eligibility/business-rule evaluation and approval execution.

#### Approval Pipeline
Approval is modeled as a chain of handlers: `src/approval/Chain.java`, `src/approval/ExpenseHandler.java`, `src/approval/ReceiptValidationHandler.java`, `src/approval/ManagerApprovalHandler.java`, `src/approval/FinanceVerificationHandler.java`, `src/approval/DepartmentApprovalHandler.java`, and `src/approval/FinalApprovalHandler.java`. A submitted claim moves through validation and organizational approval stages; rejection or failure can stop the chain before payment.

#### Orchestration and Outcomes
`src/system/ReimbursementSystem.java` defines the reimbursement-system boundary, while `src/system/EmployeeReimbursementSystem.java` coordinates claim processing and `src/system/EmployeeReimbursementSystemProxy.java` provides an intermediary/proxy access layer. `src/system/ClaimOutcome.java` carries the resulting state between approval, notification, persistence, and reimbursement concerns.

#### Persistence and Pending Work
SQLite-backed persistence is encapsulated by `src/db/DatabaseManager.java`; its JDBC runtime is supplied by `lib/sqlite-jdbc-3.42.0.0.jar`. `src/db/PendingExpense.java` represents claims awaiting resolution, creating a durable boundary around deferred or incomplete approval processing.

#### Reimbursement and Payment
Approved claims are converted into reimbursement/payment records through `src/payment/ReimbursementProcessor.java`, `src/payment/Reimbursement.java`, and `src/payment/PaymentRecord.java`. Role-aware reimbursement calculations use `src/policy/ReimbursementCalculator.java` plus implementations such as `src/policy/ManagerReimbursementCalculator.java`. Payment access is abstracted by `src/payment/PaymentService.java`; `src/payment/PaymentServiceProxy.java` fronts `src/payment/RealPaymentService.java`.

#### Notifications and Observers
Workflow outcomes are published to observers through `src/observer/ExpenseClaimSubject.java` and role recipients including `src/observer/EmployeeObserver.java`, `src/observer/ManagerObserver.java`, and `src/observer/FinanceObserver.java`. Notification delivery is independently dispatched through `src/Notification/NotificationDispatcher.java` and `src/Notification/NotificationChannel.java`; `src/Notification/EmailChannel.java` uses Jakarta Mail/Angus dependencies in `lib/jakarta.mail-api-2.1.5.jar` and `lib/angus-mail-2.0.5.jar`.

Main entry points: [`src/system/ClaimOutcome.java`](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/system/ClaimOutcome.java) (Claim Outcome), [`src/system/EmployeeReimbursementSystem.java`](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/system/EmployeeReimbursementSystem.java) (Employee Reimbursement System), [`src/singleton/ExpenseManagementSystem.java`](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/singleton/ExpenseManagementSystem.java) (Expense Management System), [`src/payment/ReimbursementProcessor.java`](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/payment/ReimbursementProcessor.java) (Reimbursement Processor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application"]
  node_main(("Main<br/>entry point<br/>[Main.java]"))
  node_facade["Expense Management System<br/>application facade"]
end

subgraph group_domain["Claims &amp; Policy"]
  node_claims["Expense Claims<br/>claim domain<br/>[ExpenseClaim.java]"]
  node_expense_factory["Expense Factories<br/>factory family"]
  node_users["Users &amp; Roles<br/>role model<br/>[User.java]"]
  node_policy_factory["Policy Factory<br/>policy selection"]
  node_policy_evaluator["Policy Evaluator<br/>rules boundary"]
  node_policy_decision["Policy Decision<br/>decision result"]
  node_reimbursement_calculator["Reimbursement Calculator<br/>calculation strategy"]
end

subgraph group_workflow["Approval Workflow"]
  node_reimbursement_system["Reimbursement System<br/>system boundary"]
  node_employee_system["Employee Reimbursement System<br/>workflow orchestrator"]
  node_system_proxy["System Proxy<br/>access proxy"]
  node_approval_chain["Approval Chain<br/>chain of responsibility<br/>[Chain.java]"]
  node_claim_outcome["Claim Outcome<br/>workflow outcome<br/>[ClaimOutcome.java]"]
end

subgraph group_outcomes["Settlement &amp; Delivery"]
  node_database[("Database Manager<br/>SQLite persistence")]
  node_pending_expense["Pending Expense<br/>deferred claim"]
  node_reimbursement_processor["Reimbursement Processor<br/>settlement processor"]
  node_payment_service["Payment Service Proxy<br/>payment gateway proxy"]
  node_observers["Claim Observers<br/>outcome publisher"]
  node_notification_dispatcher["Notification Dispatcher<br/>notification delivery"]
end

node_main -->|"starts"| node_facade
node_facade -->|"creates expenses"| node_expense_factory
node_expense_factory -->|"builds"| node_claims
node_facade -->|"submits through"| node_system_proxy
node_system_proxy -->|"accesses"| node_reimbursement_system
node_reimbursement_system -->|"implemented by"| node_employee_system
node_employee_system -->|"uses roles"| node_users
node_employee_system -->|"selects policy"| node_policy_factory
node_policy_factory -->|"supplies policy to"| node_policy_evaluator
node_policy_evaluator -->|"produces"| node_policy_decision
node_employee_system -->|"executes approval"| node_approval_chain
node_policy_decision -->|"gates"| node_approval_chain
node_approval_chain -->|"returns"| node_claim_outcome
node_claim_outcome -.->|"unresolved claims"| node_pending_expense
node_pending_expense -->|"stored in"| node_database
node_claim_outcome -->|"approved claims"| node_reimbursement_processor
node_reimbursement_processor -->|"calculates"| node_reimbursement_calculator
node_reimbursement_processor -->|"initiates payment"| node_payment_service
node_claim_outcome -->|"publishes outcome"| node_observers
node_observers -->|"triggers delivery"| node_notification_dispatcher
node_claim_outcome -->|"persists state"| node_database

click node_main "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/Main.java"
click node_facade "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/singleton/ExpenseManagementSystem.java"
click node_claims "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/model/ExpenseClaim.java"
click node_expense_factory "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/factory/ExpenseFactory.java"
click node_users "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/policy/User.java"
click node_policy_factory "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/policy/ExpensePolicyFactory.java"
click node_policy_evaluator "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/policy/PolicyEvaluator.java"
click node_policy_decision "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/policy/PolicyDecision.java"
click node_reimbursement_calculator "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/policy/ReimbursementCalculator.java"
click node_reimbursement_system "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/system/ReimbursementSystem.java"
click node_employee_system "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/system/EmployeeReimbursementSystem.java"
click node_system_proxy "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/system/EmployeeReimbursementSystemProxy.java"
click node_approval_chain "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/approval/Chain.java"
click node_claim_outcome "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/system/ClaimOutcome.java"
click node_database "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/db/DatabaseManager.java"
click node_pending_expense "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/db/PendingExpense.java"
click node_reimbursement_processor "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/payment/ReimbursementProcessor.java"
click node_payment_service "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/payment/PaymentServiceProxy.java"
click node_observers "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/observer/ExpenseClaimSubject.java"
click node_notification_dispatcher "https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/Notification/NotificationDispatcher.java"

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_main,node_facade toneBlue
class node_claims,node_expense_factory,node_users,node_policy_factory,node_policy_evaluator,node_policy_decision,node_reimbursement_calculator toneAmber
class node_reimbursement_system,node_employee_system,node_system_proxy,node_approval_chain,node_claim_outcome toneMint
class node_database,node_pending_expense,node_reimbursement_processor,node_payment_service,node_observers,node_notification_dispatcher toneRose
```

## Components

### Application

- [Main](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/Main.java): entry point · `src/Main.java`
- [Expense Management System](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/singleton/ExpenseManagementSystem.java): application facade · Singleton application entry façade. · `src/singleton/ExpenseManagementSystem.java`

### Claims & Policy

- [Expense Claims](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/model/ExpenseClaim.java): claim domain · Base claim and category-specific expenses. · `src/model/ExpenseClaim.java`
- [Expense Factories](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/factory/ExpenseFactory.java): factory family · Constructs category-specific expenses. · `src/factory/ExpenseFactory.java`
- [Users & Roles](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/policy/User.java): role model · Claimant and approver context. · `src/policy/User.java`
- [Policy Factory](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/policy/ExpensePolicyFactory.java): policy selection · Selects role-specific expense policies. · `src/policy/ExpensePolicyFactory.java`
- [Policy Evaluator](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/policy/PolicyEvaluator.java): rules boundary · Evaluates eligibility before approval. · `src/policy/PolicyEvaluator.java`
- [Policy Decision](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/policy/PolicyDecision.java): decision result · `src/policy/PolicyDecision.java`
- [Reimbursement Calculator](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/policy/ReimbursementCalculator.java): calculation strategy · Applies role-aware reimbursement calculations. · `src/policy/ReimbursementCalculator.java`

### Approval Workflow

- [Reimbursement System](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/system/ReimbursementSystem.java): system boundary · Defines reimbursement processing access. · `src/system/ReimbursementSystem.java`
- [Employee Reimbursement System](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/system/EmployeeReimbursementSystem.java): workflow orchestrator · Coordinates claim processing. · `src/system/EmployeeReimbursementSystem.java`
- [System Proxy](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/system/EmployeeReimbursementSystemProxy.java): access proxy · `src/system/EmployeeReimbursementSystemProxy.java`
- [Approval Chain](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/approval/Chain.java): chain of responsibility · Runs receipt, manager, finance, department, and final approval stages. · `src/approval/Chain.java`
- [Claim Outcome](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/system/ClaimOutcome.java): workflow outcome · Carries approval result across downstream concerns. · `src/system/ClaimOutcome.java`

### Settlement & Delivery

- [Database Manager](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/db/DatabaseManager.java): SQLite persistence · Persists claims and pending work via JDBC. · `src/db/DatabaseManager.java`
- [Pending Expense](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/db/PendingExpense.java): deferred claim · Durable representation of unresolved claims. · `src/db/PendingExpense.java`
- [Reimbursement Processor](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/payment/ReimbursementProcessor.java): settlement processor · Converts approved claims into reimbursement records. · `src/payment/ReimbursementProcessor.java`
- [Payment Service Proxy](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/payment/PaymentServiceProxy.java): payment gateway proxy · Fronts the real payment service. · `src/payment/PaymentServiceProxy.java`
- [Claim Observers](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/observer/ExpenseClaimSubject.java): outcome publisher · Publishes outcomes to employee, manager, and finance recipients. · `src/observer/ExpenseClaimSubject.java`
- [Notification Dispatcher](https://github.com/archit-d300/enterprise-expense-reimbursement-system/blob/main/src/Notification/NotificationDispatcher.java): notification delivery · Dispatches through configured notification channels. · `src/Notification/NotificationDispatcher.java`

## Connections

- Main → Expense Management System: starts
- Expense Management System → Expense Factories: creates expenses
- Expense Factories → Expense Claims: builds
- Expense Management System → System Proxy: submits through
- System Proxy → Reimbursement System: accesses
- Reimbursement System → Employee Reimbursement System: implemented by
- Employee Reimbursement System → Users & Roles: uses roles
- Employee Reimbursement System → Policy Factory: selects policy
- Policy Factory → Policy Evaluator: supplies policy to
- Policy Evaluator → Policy Decision: produces
- Employee Reimbursement System → Approval Chain: executes approval
- Policy Decision → Approval Chain: gates
- Approval Chain → Claim Outcome: returns
- Claim Outcome → Pending Expense: unresolved claims
- Pending Expense → Database Manager: stored in
- Claim Outcome → Reimbursement Processor: approved claims
- Reimbursement Processor → Reimbursement Calculator: calculates
- Reimbursement Processor → Payment Service Proxy: initiates payment
- Claim Outcome → Claim Observers: publishes outcome
- Claim Observers → Notification Dispatcher: triggers delivery
- Claim Outcome → Database Manager: persists state
