# tejasmedade/e-wallet-payment-system architecture

> Architecture diagram of the GitHub repository tejasmedade/e-wallet-payment-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tejasmedade/e-wallet-payment-system
- Repository: https://github.com/tejasmedade/e-wallet-payment-system

## Overview

##### Project type and purpose
- This is a monolithic, REST-based backend service (no dedicated frontend code) for a digital wallet/payment system (“E-Wallet Payment System”).
- Purpose: expose HTTP endpoints (via Spring Boot controllers) to manage customers, admins, wallets, bank accounts, beneficiaries, bills, and transactions, with MySQL as persistent storage.

##### File structure
- Top-level pom.xml & Maven wrapper: standard Spring Boot project build.
- src/main/java/com/masai:
- controllers/ → REST endpoints (CustomerController, WalletController, etc.)
- services & servicesImplementation/ → business logic interfaces + implementations
- repository/ → Spring Data JPA repositories mapping to DB tables
- model/ → JPA entity classes (Customer, Wallet, Transaction, Beneficiary, Bill, Address, CurrentSession, etc.)
- dto/ → data transfer objects for request/response payloads
- exceptions/ → custom exceptions + GlobalExceptionHandler
- src/main/resources/application.properties: DB config, server port, messages.properties

##### README for additional insights
- Confirms layered architecture: REST API built on Spring Boot + Hibernate + MySQL.
- Swagger UI for interactive API docs.

##### Detailed elements to capture
- Controllers for each resource set (Customer, Wallet, BankAccount, Beneficiary, Bill, Transaction, Login/Logout for Admin & Customer).
- Services + Implementations (interface → concrete class)
- Repositories mapped to each Entity
- Entities: Customer, Admin, Wallet, BankAccount, Beneficiary, Bill, Transaction, Address, CurrentCustomerSession, CurrentAdminSession
- Exception handler (GlobalExceptionHandler) as an interceptor of errors between Controller and Client
- ApplicationProperties (as config) feeding into DataSource configuration

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "External Clients"
        Clients["Mobile App / Web App / Postman / Swagger UI"]:::external
    end
    Clients -->|HTTP Request| API["API Gateway / Load Balancer"]:::external
    API -->|Forward Request| Monolith

    subgraph "Spring Boot Monolith"
        style Monolith stroke-dasharray: 5 5

        subgraph "Presentation Layer"
            C1["LoginLogoutAdminController"]:::controller
            C2["LoginLogoutCustomerController"]:::controller
            C3["CustomerController"]:::controller
            C4["WalletController"]:::controller
            C5["TransactionController"]:::controller
            C6["BankAccountController"]:::controller
            C7["BeneficiaryController"]:::controller
            C8["BillPaymentController"]:::controller
            C9["AddressController"]:::controller
        end

        subgraph "Service Layer"
            S1["LoginLogoutAdminService"]:::service
            S2["LoginLogoutCustomerService"]:::service
            S3["CurrentAdminSessionService"]:::service
            S4["CurrentCustomerSessionService"]:::service
            S5["CustomerService"]:::service
            S6["WalletService"]:::service
            S7["TransactionService"]:::service
            S8["BankAccountService"]:::service
            S9["BeneficiaryService"]:::service
            S10["BillService"]:::service
            S11["AddressService"]:::service
        end

        subgraph "Repository Layer"
            R1["CurrentAdminSessionRepo"]:::repo
            R2["CurrentCustomerSessionRepo"]:::repo
            R3["CustomerRepo"]:::repo
            R4["WalletRepo"]:::repo
            R5["TransactionRepo"]:::repo
            R6["BankAccountRepo"]:::repo
            R7["BeneficiaryRepo"]:::repo
            R8["BillRepo"]:::repo
            R9["AddressRepo"]:::repo
        end

        subgraph "Domain Model"
            D1["CurrentAdminSession"]:::domain
            D2["CurrentCustomerSession"]:::domain
            D3["Customer"]:::domain
            D4["Wallet"]:::domain
            D5["Transaction"]:::domain
            D6["BankAccount"]:::domain
            D7["Beneficiary"]:::domain
            D8["Bill"]:::domain
            D9["Address"]:::domain
        end

        EH["GlobalExceptionHandler"]:::controller
    end

    %% Flows
    API -->|REST Call| C1
    API --> C2
    API --> C3
    API --> C4
    API --> C5
    API --> C6
    API --> C7
    API --> C8
    API --> C9

    C1 -->|calls| S1
    C2 -->|calls| S2
    C3 -->|calls| S5
    C4 -->|calls| S6
    C5 -->|calls| S7
    C6 -->|calls| S8
    C7 -->|calls| S9
    C8 -->|calls| S10
    C9 -->|calls| S11

    S1 -->|uses| R1
    S2 -->|uses| R2
    S3 -->|uses| R1
    S4 -->|uses| R2
    S5 -->|uses| R3
    S6 -->|uses| R4
    S7 -->|uses| R5
    S8 -->|uses| R6
    S9 -->|uses| R7
    S10 -->|uses| R8
    S11 -->|uses| R9

    R1 -->|SQL Queries| DB
    R2 -->|SQL Queries| DB
    R3 -->|SQL Queries| DB
    R4 -->|SQL Queries| DB
    R5 -->|SQL Queries| DB
    R6 -->|SQL Queries| DB
    R7 -->|SQL Queries| DB
    R8 -->|SQL Queries| DB
    R9 -->|SQL Queries| DB

    C1 -->|throws| EH
    C2 --> EH
    C3 --> EH
    C4 --> EH
    C5 --> EH
    C6 --> EH
    C7 --> EH
    C8 --> EH
    C9 --> EH
    EH -->|HTTP Error Response| Clients

    Monolith -->|logs/metrics| Monit["Monitoring / Logging System"]:::external

    DB["MySQL Database"]:::database

    %% Click Events
    click C1 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/controllers/LoginLogoutAdminController.java"
    click C2 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/controllers/LoginLogoutCustomerController.java"
    click S1 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/services/LoginLogoutAdminService.java"
    click S2 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/services/LoginLogoutCustomerService.java"
    click S3 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/services/CurrentAdminSessionService.java"
    click S4 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/services/CurrentCustomerSessionService.java"
    click S5 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/services/CustomerService.java"
    click S6 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/services/WalletService.java"
    click S7 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/services/TransactionService.java"
    click S8 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/services/BankAccountService.java"
    click S9 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/services/BeneficiaryService.java"
    click S10 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/services/BillService.java"
    click S11 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/services/AddressService.java"
    click R1 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/repository/CurrentAdminSessionRepo.java"
    click R2 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/repository/CurrentCustomerSessionRepo.java"
    click R3 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/repository/CustomerRepo.java"
    click R4 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/repository/WalletRepo.java"
    click R5 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/repository/TransactionRepo.java"
    click R6 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/repository/BankAccountRepo.java"
    click R7 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/repository/BeneficiaryRepo.java"
    click R8 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/repository/BillRepo.java"
    click R9 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/repository/AddressRepo.java"
    click D1 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/model/CurrentAdminSession.java"
    click D2 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/model/CurrentCustomerSession.java"
    click D3 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/model/Customer.java"
    click D4 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/model/Wallet.java"
    click D5 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/model/Transaction.java"
    click D6 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/model/BankAccount.java"
    click D7 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/model/Beneficiary.java"
    click D8 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/model/Bill.java"
    click D9 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/model/Address.java"
    click EH "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/java/com/masai/exceptions/GlobalExceptionHandler.java"
    click Config1 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/resources/application.properties"
    click Config2 "https://github.com/tejasmedade/e-wallet-payment-system/blob/main/src/main/resources/messages.properties"

    %% Styles
    classDef controller fill:#ADD8E6,stroke:#000
    classDef service fill:#90EE90,stroke:#000
    classDef repo fill:#FFA500,stroke:#000
    classDef domain fill:#D3D3D3,stroke:#000
    classDef database fill:#C0C0C0,stroke:#000
    classDef external fill:#F0E68C,stroke:#000
```
