# lastcoderboy/finice architecture

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

- Interactive diagram: https://gitdiagram.com/lastcoderboy/finice
- Repository: https://github.com/lastcoderboy/finice

## Overview

FinIce is a microservices banking backend. A client request enters through the JWT-validating gateway, then reaches authentication, account, or transaction APIs; transfers coordinate account holds/debits/credits and persist outcomes, while authentication supports verification and token lifecycle. The README documents compensation and external-payment flows that the sampled transaction implementation does not expose, so those relationships are shown as unverified. The graph emphasizes documented capabilities and sampled modules; unsampled implementation details are represented only by exact directories.

Main entry points: [`api-gateway/src/main/java/com/jk/finice/apigateway/config/GatewayConfig.java`](https://github.com/lastcoderboy/finice/blob/master/api-gateway/src/main/java/com/jk/finice/apigateway/config/GatewayConfig.java) (API gateway), [`transaction-service/src/main/java/com/jk/finice/transactionservice/service/impl/TransactionServiceImpl.java`](https://github.com/lastcoderboy/finice/blob/master/transaction-service/src/main/java/com/jk/finice/transactionservice/service/impl/TransactionServiceImpl.java) (Transfer orchestration), [`auth-service/src/main/java/com/jk/finice/authservice/service/impl/AuthenticationServiceImpl.java`](https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/service/impl/AuthenticationServiceImpl.java) (Authentication flow), [`auth-service/src/main/java/com/jk/finice/authservice/controller/AuthenticationController.java`](https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/controller/AuthenticationController.java) (Auth endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["API edge"]
  node_gateway["API gateway<br/>[GatewayConfig.java]"]
  node_jwtfilter["JWT filter"]
end

subgraph group_identity["Identity and access"]
  node_authapi["Auth endpoints"]
  node_authflow["Authentication flow"]
  node_users[("User accounts<br/>[User.java]")]
  node_refresh["Refresh and revoke"]
  node_email["Email verification<br/>[EmailService.java]"]
end

subgraph group_banking["Accounts and money movement"]
  node_accountapi["Account endpoints"]
  node_accountflow["Account operations"]
  node_accounts[("Account balances<br/>[Account.java]")]
  node_txapi["Transaction endpoints"]
  node_txflow["Transfer orchestration"]
  node_txpersist["Idempotent persistence"]
  node_transactions[("Transaction records<br/>[Transaction.java]")]
  node_iban["IBAN validation<br/>[IbanValidator.java]"]
  node_externalpay["External payment rail"]
end

subgraph group_platform["Shared platform"]
  node_discovery["Service discovery"]
  node_shared["Shared contracts<br/>[ApiResponse.java]"]
  node_redis[("Redis revocation<br/>[RedisService.java]")]
end

node_client(("Banking client"))
node_mail["Mail provider"]

node_client -->|"sends requests"| node_gateway
node_gateway -->|"filters requests"| node_jwtfilter
node_gateway -.->|"routes auth"| node_authapi
node_gateway -.->|"routes accounts"| node_accountapi
node_gateway -.->|"routes transfers"| node_txapi
node_authapi -.->|"delegates to"| node_authflow
node_authflow -.->|"manages users"| node_users
node_authflow -.->|"rotates tokens"| node_refresh
node_authflow -.->|"starts verification"| node_email
node_email -->|"sends email"| node_mail
node_accountapi -->|"delegates to"| node_accountflow
node_accountflow -.->|"updates balances"| node_accounts
node_txapi -.->|"delegates to"| node_txflow
node_txflow -.->|"persists idempotently"| node_txpersist
node_txpersist -->|"saves records"| node_transactions
node_txflow -.->|"calls internal APIs"| node_accountflow
node_txflow -.->|"validates IBAN"| node_iban
node_txflow -.->|"submits payment"| node_externalpay
node_refresh -.->|"blacklists tokens"| node_redis
node_gateway -.->|"discovers services"| node_discovery
node_authapi -.->|"uses response contract"| node_shared
node_accountapi -->|"uses response contract"| node_shared
node_txflow -->|"uses response contract"| node_shared

click node_gateway "https://github.com/lastcoderboy/finice/blob/master/api-gateway/src/main/java/com/jk/finice/apigateway/config/GatewayConfig.java"
click node_jwtfilter "https://github.com/lastcoderboy/finice/blob/master/api-gateway/src/main/java/com/jk/finice/apigateway/security/JwtAuthenticationFilter.java"
click node_authapi "https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/controller/AuthenticationController.java"
click node_authflow "https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/service/impl/AuthenticationServiceImpl.java"
click node_users "https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/entity/User.java"
click node_refresh "https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/service/impl/RefreshTokenServiceImpl.java"
click node_email "https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/service/email/EmailService.java"
click node_accountapi "https://github.com/lastcoderboy/finice/blob/master/account-service/src/main/java/com/jk/finice/accountservice/controller/AccountController.java"
click node_accountflow "https://github.com/lastcoderboy/finice/blob/master/account-service/src/main/java/com/jk/finice/accountservice/service/impl/AccountServiceImpl.java"
click node_accounts "https://github.com/lastcoderboy/finice/blob/master/account-service/src/main/java/com/jk/finice/accountservice/entity/Account.java"
click node_txapi "https://github.com/lastcoderboy/finice/blob/master/transaction-service/src/main/java/com/jk/finice/transactionservice/controller/TransactionController.java"
click node_txflow "https://github.com/lastcoderboy/finice/blob/master/transaction-service/src/main/java/com/jk/finice/transactionservice/service/impl/TransactionServiceImpl.java"
click node_txpersist "https://github.com/lastcoderboy/finice/blob/master/transaction-service/src/main/java/com/jk/finice/transactionservice/service/persistence/TransactionPersistenceService.java"
click node_transactions "https://github.com/lastcoderboy/finice/blob/master/transaction-service/src/main/java/com/jk/finice/transactionservice/entity/Transaction.java"
click node_iban "https://github.com/lastcoderboy/finice/blob/master/transaction-service/src/main/java/com/jk/finice/transactionservice/service/component/IbanValidator.java"
click node_externalpay "https://github.com/lastcoderboy/finice/blob/master/transaction-service/src/main/java/com/jk/finice/transactionservice/externalGateway/ExternalPaymentGateway.java"
click node_discovery "https://github.com/lastcoderboy/finice/blob/master/eureka-server/src/main/java/com/jk/finice/eurekaserver/EurekaServerApplication.java"
click node_shared "https://github.com/lastcoderboy/finice/blob/master/common-library/src/main/java/com/jk/finice/commonlibrary/dto/ApiResponse.java"
click node_redis "https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/config/redis/RedisService.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_gateway,node_jwtfilter,node_client toneBlue
class node_authapi,node_authflow,node_users,node_refresh,node_email toneAmber
class node_accountapi,node_accountflow,node_accounts,node_txapi,node_txflow,node_txpersist,node_transactions,node_iban,node_externalpay toneMint
class node_discovery,node_shared,node_redis toneRose
class node_mail toneIndigo
```

## Components

### API edge

- [API gateway](https://github.com/lastcoderboy/finice/blob/master/api-gateway/src/main/java/com/jk/finice/apigateway/config/GatewayConfig.java): `api-gateway/src/main/java/com/jk/finice/apigateway/config/GatewayConfig.java`
- [JWT filter](https://github.com/lastcoderboy/finice/blob/master/api-gateway/src/main/java/com/jk/finice/apigateway/security/JwtAuthenticationFilter.java): `api-gateway/src/main/java/com/jk/finice/apigateway/security/JwtAuthenticationFilter.java`

### Identity and access

- [Auth endpoints](https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/controller/AuthenticationController.java): `auth-service/src/main/java/com/jk/finice/authservice/controller/AuthenticationController.java`
- [Authentication flow](https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/service/impl/AuthenticationServiceImpl.java): `auth-service/src/main/java/com/jk/finice/authservice/service/impl/AuthenticationServiceImpl.java`
- [User accounts](https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/entity/User.java): `auth-service/src/main/java/com/jk/finice/authservice/entity/User.java`
- [Refresh and revoke](https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/service/impl/RefreshTokenServiceImpl.java): `auth-service/src/main/java/com/jk/finice/authservice/service/impl/RefreshTokenServiceImpl.java`
- [Email verification](https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/service/email/EmailService.java): `auth-service/src/main/java/com/jk/finice/authservice/service/email/EmailService.java`

### Accounts and money movement

- [Account endpoints](https://github.com/lastcoderboy/finice/blob/master/account-service/src/main/java/com/jk/finice/accountservice/controller/AccountController.java): `account-service/src/main/java/com/jk/finice/accountservice/controller/AccountController.java`
- [Account operations](https://github.com/lastcoderboy/finice/blob/master/account-service/src/main/java/com/jk/finice/accountservice/service/impl/AccountServiceImpl.java): `account-service/src/main/java/com/jk/finice/accountservice/service/impl/AccountServiceImpl.java`
- [Account balances](https://github.com/lastcoderboy/finice/blob/master/account-service/src/main/java/com/jk/finice/accountservice/entity/Account.java): `account-service/src/main/java/com/jk/finice/accountservice/entity/Account.java`
- [Transaction endpoints](https://github.com/lastcoderboy/finice/blob/master/transaction-service/src/main/java/com/jk/finice/transactionservice/controller/TransactionController.java): `transaction-service/src/main/java/com/jk/finice/transactionservice/controller/TransactionController.java`
- [Transfer orchestration](https://github.com/lastcoderboy/finice/blob/master/transaction-service/src/main/java/com/jk/finice/transactionservice/service/impl/TransactionServiceImpl.java): `transaction-service/src/main/java/com/jk/finice/transactionservice/service/impl/TransactionServiceImpl.java`
- [Idempotent persistence](https://github.com/lastcoderboy/finice/blob/master/transaction-service/src/main/java/com/jk/finice/transactionservice/service/persistence/TransactionPersistenceService.java): `transaction-service/src/main/java/com/jk/finice/transactionservice/service/persistence/TransactionPersistenceService.java`
- [Transaction records](https://github.com/lastcoderboy/finice/blob/master/transaction-service/src/main/java/com/jk/finice/transactionservice/entity/Transaction.java): `transaction-service/src/main/java/com/jk/finice/transactionservice/entity/Transaction.java`
- [IBAN validation](https://github.com/lastcoderboy/finice/blob/master/transaction-service/src/main/java/com/jk/finice/transactionservice/service/component/IbanValidator.java): `transaction-service/src/main/java/com/jk/finice/transactionservice/service/component/IbanValidator.java`
- [External payment rail](https://github.com/lastcoderboy/finice/blob/master/transaction-service/src/main/java/com/jk/finice/transactionservice/externalGateway/ExternalPaymentGateway.java): `transaction-service/src/main/java/com/jk/finice/transactionservice/externalGateway/ExternalPaymentGateway.java`

### Shared platform

- [Service discovery](https://github.com/lastcoderboy/finice/blob/master/eureka-server/src/main/java/com/jk/finice/eurekaserver/EurekaServerApplication.java): `eureka-server/src/main/java/com/jk/finice/eurekaserver/EurekaServerApplication.java`
- [Shared contracts](https://github.com/lastcoderboy/finice/blob/master/common-library/src/main/java/com/jk/finice/commonlibrary/dto/ApiResponse.java): `common-library/src/main/java/com/jk/finice/commonlibrary/dto/ApiResponse.java`
- [Redis revocation](https://github.com/lastcoderboy/finice/blob/master/auth-service/src/main/java/com/jk/finice/authservice/config/redis/RedisService.java): `auth-service/src/main/java/com/jk/finice/authservice/config/redis/RedisService.java`

### Other components

- **Banking client**
- **Mail provider**

## Connections

- Banking client → API gateway: sends requests (evidence: `README.md`)
- API gateway → JWT filter: filters requests (evidence: `README.md`)
- API gateway → Auth endpoints: routes auth (evidence: `README.md`)
- API gateway → Account endpoints: routes accounts (evidence: `README.md`)
- API gateway → Transaction endpoints: routes transfers (evidence: `README.md`)
- Auth endpoints → Authentication flow: delegates to
- Authentication flow → User accounts: manages users (evidence: `auth-service/src/main/java/com/jk/finice/authservice/service/impl/AuthenticationServiceImpl.java`)
- Authentication flow → Refresh and revoke: rotates tokens
- Authentication flow → Email verification: starts verification (evidence: `auth-service/src/main/java/com/jk/finice/authservice/service/impl/AuthenticationServiceImpl.java`)
- Email verification → Mail provider: sends email (evidence: `auth-service/src/main/java/com/jk/finice/authservice/service/email/EmailService.java`)
- Account endpoints → Account operations: delegates to (evidence: `account-service/src/main/java/com/jk/finice/accountservice/controller/AccountController.java`)
- Account operations → Account balances: updates balances (evidence: `account-service/src/main/java/com/jk/finice/accountservice/service/impl/AccountServiceImpl.java`)
- Transaction endpoints → Transfer orchestration: delegates to
- Transfer orchestration → Idempotent persistence: persists idempotently (evidence: `README.md`)
- Idempotent persistence → Transaction records: saves records (evidence: `transaction-service/src/main/java/com/jk/finice/transactionservice/service/persistence/TransactionPersistenceService.java`)
- Transfer orchestration → Account operations: calls internal APIs (evidence: `README.md`)
- Transfer orchestration → IBAN validation: validates IBAN (evidence: `transaction-service/src/main/java/com/jk/finice/transactionservice/service/impl/TransactionServiceImpl.java`)
- Transfer orchestration → External payment rail: submits payment (evidence: `README.md`)
- Refresh and revoke → Redis revocation: blacklists tokens (evidence: `README.md`)
- API gateway → Service discovery: discovers services (evidence: `README.md`)
- Auth endpoints → Shared contracts: uses response contract (evidence: `auth-service/src/main/java/com/jk/finice/authservice/controller/AuthenticationController.java`)
- Account endpoints → Shared contracts: uses response contract (evidence: `account-service/src/main/java/com/jk/finice/accountservice/controller/AccountController.java`)
- Transfer orchestration → Shared contracts: uses response contract
