# bachvietle/e-wallet-project architecture

> Architecture diagram of the GitHub repository bachvietle/e-wallet-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bachvietle/e-wallet-project
- Repository: https://github.com/bachvietle/e-wallet-project

## Overview

This is a Spring-based e-wallet backend. The main workflow is registration or login, authentication, and then balance or transfer/history operations. Transfers lock both wallets, update balances, persist a transaction and ledger, and publish a success event. The tree also identifies notification consumers, rate limiting, idempotency, and caching. The README is empty; edges below are limited to relationships shown in excerpts or the source index, so unsampled event and infrastructure wiring is not inferred.

Main entry points: [`E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/service/AuthService.java`](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/service/AuthService.java) (Auth Service), [`E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/service/TransactionService.java`](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/service/TransactionService.java) (Transfer & History), [`E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/controller/WalletController.java`](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/controller/WalletController.java) (Wallet API), [`E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/service/WalletService.java`](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/service/WalletService.java) (Wallet Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Identity &amp; Access"]
  node_auth_api["Auth API"]
  node_auth_service["Auth Service<br/>[AuthService.java]"]
  node_jwt["JWT Service<br/>[JwtService.java]"]
  node_user_service["User Details"]
  node_user_store[("User Store")]
  node_refresh_store[("Refresh Tokens")]
  node_verify_store[("Verification Tokens")]
end

subgraph group_money["Wallet &amp; Transactions"]
  node_wallet_api["Wallet API"]
  node_wallet_service["Wallet Service<br/>[WalletService.java]"]
  node_wallet_store[("Wallet Store")]
  node_transaction_api["Transaction API"]
  node_transaction_service["Transfer &amp; History"]
  node_transaction_store[("Transaction Store")]
  node_ledger_store[("Ledger Store")]
end

subgraph group_platform["Shared Platform"]
  node_cache["Cache Helper<br/>[CacheHelper.java]"]
  node_rabbit["RabbitMQ Config"]
end

subgraph group_notify["Notifications"]
  node_email_service["Email Service<br/>[EmailService.java]"]
  node_email_consumer["Email Consumer<br/>[EmailConsumer.java]"]
  node_notification_consumer["Notification Consumer"]
end

node_client(("Client"))
node_external_google(("Google Identity"))

node_client -->|"requests auth"| node_auth_api
node_auth_api -->|"delegates auth"| node_auth_service
node_auth_service -->|"issues tokens"| node_jwt
node_auth_service -->|"reads and saves"| node_user_store
node_auth_service -->|"saves refresh token"| node_refresh_store
node_auth_service -->|"saves verification token"| node_verify_store
node_auth_service -->|"creates wallet"| node_wallet_service
node_auth_service -->|"uses email"| node_email_service
node_auth_service -->|"verifies identity"| node_external_google
node_user_service -->|"loads user"| node_user_store
node_client -.->|"requests wallet"| node_wallet_api
node_wallet_api -->|"delegates wallet"| node_wallet_service
node_wallet_service -->|"reads and writes"| node_wallet_store
node_client -->|"requests transfer"| node_transaction_api
node_transaction_api -->|"delegates transfer"| node_transaction_service
node_transaction_service -->|"locks and updates"| node_wallet_store
node_transaction_service -->|"saves transaction"| node_transaction_store
node_transaction_service -->|"saves ledger"| node_ledger_store
node_transaction_service -->|"evicts balance"| node_cache
node_wallet_api -->|"requests history"| node_transaction_service
node_transaction_service -->|"queries history"| node_ledger_store
node_email_consumer -.->|"uses email"| node_email_service
node_notification_consumer -.->|"messaging wiring"| node_rabbit

click node_auth_api "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/controller/AuthController.java"
click node_auth_service "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/service/AuthService.java"
click node_jwt "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/common/security/JwtService.java"
click node_user_service "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/user/service/CustomerUserDetailsService.java"
click node_user_store "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/user/repository/UserRepository.java"
click node_refresh_store "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/repository/RefreshTokenRepository.java"
click node_verify_store "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/repository/VerificationTokenRepository.java"
click node_wallet_api "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/controller/WalletController.java"
click node_wallet_service "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/service/WalletService.java"
click node_wallet_store "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/repository/WalletRepository.java"
click node_transaction_api "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/controller/TransactionController.java"
click node_transaction_service "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/service/TransactionService.java"
click node_transaction_store "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/repository/TransactionRepository.java"
click node_ledger_store "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/repository/TransactionLedgerRepository.java"
click node_cache "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/common/cache/CacheHelper.java"
click node_email_service "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/notification/EmailService.java"
click node_email_consumer "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/notification/EmailConsumer.java"
click node_notification_consumer "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/notification/NotificationConsumer.java"
click node_rabbit "https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/common/messaging/RabbitMQConfig.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_auth_api,node_auth_service,node_jwt,node_user_service,node_user_store,node_refresh_store,node_verify_store,node_client toneBlue
class node_wallet_api,node_wallet_service,node_wallet_store,node_transaction_api,node_transaction_service,node_transaction_store,node_ledger_store toneAmber
class node_cache,node_rabbit toneMint
class node_email_service,node_email_consumer,node_notification_consumer toneRose
class node_external_google toneIndigo
```

## Components

### Identity & Access

- [Auth API](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/controller/AuthController.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/controller/AuthController.java`
- [Auth Service](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/service/AuthService.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/service/AuthService.java`
- [JWT Service](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/common/security/JwtService.java): `E-Wallet/src/main/java/com/BachLe/ewallet/common/security/JwtService.java`
- [User Details](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/user/service/CustomerUserDetailsService.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/user/service/CustomerUserDetailsService.java`
- [User Store](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/user/repository/UserRepository.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/user/repository/UserRepository.java`
- [Refresh Tokens](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/repository/RefreshTokenRepository.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/repository/RefreshTokenRepository.java`
- [Verification Tokens](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/repository/VerificationTokenRepository.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/repository/VerificationTokenRepository.java`

### Wallet & Transactions

- [Wallet API](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/controller/WalletController.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/controller/WalletController.java`
- [Wallet Service](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/service/WalletService.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/service/WalletService.java`
- [Wallet Store](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/repository/WalletRepository.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/repository/WalletRepository.java`
- [Transaction API](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/controller/TransactionController.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/controller/TransactionController.java`
- [Transfer & History](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/service/TransactionService.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/service/TransactionService.java`
- [Transaction Store](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/repository/TransactionRepository.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/repository/TransactionRepository.java`
- [Ledger Store](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/repository/TransactionLedgerRepository.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/repository/TransactionLedgerRepository.java`

### Shared Platform

- [Cache Helper](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/common/cache/CacheHelper.java): `E-Wallet/src/main/java/com/BachLe/ewallet/common/cache/CacheHelper.java`
- [RabbitMQ Config](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/common/messaging/RabbitMQConfig.java): `E-Wallet/src/main/java/com/BachLe/ewallet/common/messaging/RabbitMQConfig.java`

### Notifications

- [Email Service](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/notification/EmailService.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/notification/EmailService.java`
- [Email Consumer](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/notification/EmailConsumer.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/notification/EmailConsumer.java`
- [Notification Consumer](https://github.com/bachvietle/e-wallet-project/blob/main/E-Wallet/src/main/java/com/BachLe/ewallet/domain/notification/NotificationConsumer.java): `E-Wallet/src/main/java/com/BachLe/ewallet/domain/notification/NotificationConsumer.java`

### Other components

- **Client**
- **Google Identity**

## Connections

- Client → Auth API: requests auth (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/controller/AuthController.java`)
- Auth API → Auth Service: delegates auth (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/controller/AuthController.java`)
- Auth Service → JWT Service: issues tokens (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/service/AuthService.java`)
- Auth Service → User Store: reads and saves (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/service/AuthService.java`)
- Auth Service → Refresh Tokens: saves refresh token (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/service/AuthService.java`)
- Auth Service → Verification Tokens: saves verification token (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/service/AuthService.java`)
- Auth Service → Wallet Service: creates wallet (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/service/AuthService.java`)
- Auth Service → Email Service: uses email (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/service/AuthService.java`)
- Auth Service → Google Identity: verifies identity (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/auth/service/AuthService.java`)
- User Details → User Store: loads user (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/user/service/CustomerUserDetailsService.java`)
- Client → Wallet API: requests wallet
- Wallet API → Wallet Service: delegates wallet (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/controller/WalletController.java`)
- Wallet Service → Wallet Store: reads and writes (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/service/WalletService.java`)
- Client → Transaction API: requests transfer (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/controller/TransactionController.java`)
- Transaction API → Transfer & History: delegates transfer (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/controller/TransactionController.java`)
- Transfer & History → Wallet Store: locks and updates (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/service/TransactionService.java`)
- Transfer & History → Transaction Store: saves transaction (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/service/TransactionService.java`)
- Transfer & History → Ledger Store: saves ledger (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/service/TransactionService.java`)
- Transfer & History → Cache Helper: evicts balance (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/service/TransactionService.java`)
- Wallet API → Transfer & History: requests history (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/wallet/controller/WalletController.java`)
- Transfer & History → Ledger Store: queries history (evidence: `E-Wallet/src/main/java/com/BachLe/ewallet/domain/transaction/service/TransactionService.java`)
- Email Consumer → Email Service: uses email
- Notification Consumer → RabbitMQ Config: messaging wiring
