# kerolos-nashat/flowpay architecture

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

- Interactive diagram: https://gitdiagram.com/kerolos-nashat/flowpay
- Repository: https://github.com/kerolos-nashat/flowpay

## Overview

FlowPay is a Spring-based wallet API. Users register or log in, then authenticated wallet requests retrieve balances, deposit, withdraw, transfer funds, or inspect transaction history. Registration creates a user and an initial wallet; wallet operations update balances and record transactions. Authentication uses JWTs, while user and wallet data are represented by JPA entities and repositories. The README is empty, so capabilities are inferred from the provided source index and excerpts; database wiring beyond the migration and repository definitions is not shown.

Main entry points: [`src/main/java/com/kero/flowpay/model/Transaction.java`](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/model/Transaction.java) (Transaction entity), [`src/main/java/com/kero/flowpay/repository/UserRepository.java`](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/repository/UserRepository.java) (User repository), [`src/main/java/com/kero/flowpay/repository/WalletRepository.java`](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/repository/WalletRepository.java) (Wallet repository), [`src/main/java/com/kero/flowpay/service/AuthService.java`](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/service/AuthService.java) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API endpoints"]
  node_auth_api["Auth endpoints"]
  node_user_api["User endpoints"]
  node_wallet_api["Wallet endpoints"]
  node_hello_api["Hello endpoint"]
end

subgraph group_identity["Identity and security"]
  node_auth_service["Authentication<br/>[AuthService.java]"]
  node_user_service["User registration<br/>[UserService.java]"]
  node_security_config["Security configuration"]
  node_jwt_filter["JWT filter"]
  node_jwt_service["JWT service<br/>[JwtService.java]"]
end

subgraph group_wallet["Wallet operations"]
  node_wallet_service["Wallet operations<br/>[WalletService.java]"]
end

subgraph group_data["Persistence model"]
  node_user_entity["User entity<br/>[User.java]"]
  node_wallet_entity["Wallet entity<br/>[Wallet.java]"]
  node_transaction_entity["Transaction entity<br/>[Transaction.java]"]
  node_transaction_type["Transaction type"]
  node_transaction_status["Transaction status"]
  node_user_repo["User repository"]
  node_wallet_repo["Wallet repository"]
  node_transaction_repo["Transaction repository"]
  node_schema["SQL schema"]
end

node_client(("API client"))
node_database[("Relational database")]

node_client -->|"requests"| node_auth_api
node_client -->|"requests"| node_user_api
node_client -->|"requests"| node_wallet_api
node_auth_api -->|"delegates"| node_auth_service
node_user_api -->|"delegates"| node_user_service
node_wallet_api -->|"delegates"| node_wallet_service
node_auth_service -->|"looks up user"| node_user_repo
node_auth_service -->|"generates token"| node_jwt_service
node_user_service -->|"creates and reads"| node_user_repo
node_user_service -->|"creates wallet"| node_wallet_repo
node_security_config -->|"configures"| node_jwt_filter
node_security_config -->|"configures"| node_jwt_service
node_jwt_filter -->|"validates token"| node_jwt_service
node_wallet_service -->|"reads and updates"| node_wallet_repo
node_wallet_service -->|"records and reads"| node_transaction_repo
node_user_repo -->|"persists"| node_user_entity
node_wallet_repo -->|"persists"| node_wallet_entity
node_transaction_repo -->|"persists"| node_transaction_entity
node_transaction_entity -->|"uses enum"| node_transaction_type
node_transaction_entity -->|"uses enum"| node_transaction_status
node_transaction_entity -->|"belongs to wallet"| node_wallet_entity
node_wallet_entity -->|"belongs to user"| node_user_entity
node_schema -.->|"defines schema"| node_database
node_user_repo -.->|"stores data"| node_database
node_wallet_repo -.->|"stores data"| node_database
node_transaction_repo -.->|"stores data"| node_database

click node_auth_api "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/controller/AuthController.java"
click node_user_api "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/controller/UserController.java"
click node_wallet_api "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/controller/WalletController.java"
click node_hello_api "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/controller/HelloController.java"
click node_auth_service "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/service/AuthService.java"
click node_user_service "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/service/UserService.java"
click node_security_config "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/config/SecurityConfig.java"
click node_jwt_filter "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/security/JwtAuthenticationFilter.java"
click node_jwt_service "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/security/JwtService.java"
click node_wallet_service "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/service/WalletService.java"
click node_user_entity "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/model/User.java"
click node_wallet_entity "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/model/Wallet.java"
click node_transaction_entity "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/model/Transaction.java"
click node_transaction_type "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/model/TransactionType.java"
click node_transaction_status "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/model/TransactionStatus.java"
click node_user_repo "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/repository/UserRepository.java"
click node_wallet_repo "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/repository/WalletRepository.java"
click node_transaction_repo "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/repository/TransactionRepository.java"
click node_schema "https://github.com/kerolos-nashat/flowpay/blob/main/src/main/resources/db/migration/V1__initial_schema.sql"

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_user_api,node_wallet_api,node_hello_api,node_client toneBlue
class node_auth_service,node_user_service,node_security_config,node_jwt_filter,node_jwt_service,node_database toneAmber
class node_wallet_service toneMint
class node_user_entity,node_wallet_entity,node_transaction_entity,node_transaction_type,node_transaction_status,node_user_repo,node_wallet_repo,node_transaction_repo,node_schema toneRose
```

## Components

### API endpoints

- [Auth endpoints](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/controller/AuthController.java): `src/main/java/com/kero/flowpay/controller/AuthController.java`
- [User endpoints](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/controller/UserController.java): `src/main/java/com/kero/flowpay/controller/UserController.java`
- [Wallet endpoints](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/controller/WalletController.java): `src/main/java/com/kero/flowpay/controller/WalletController.java`
- [Hello endpoint](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/controller/HelloController.java): `src/main/java/com/kero/flowpay/controller/HelloController.java`

### Identity and security

- [Authentication](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/service/AuthService.java): `src/main/java/com/kero/flowpay/service/AuthService.java`
- [User registration](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/service/UserService.java): `src/main/java/com/kero/flowpay/service/UserService.java`
- [Security configuration](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/config/SecurityConfig.java): `src/main/java/com/kero/flowpay/config/SecurityConfig.java`
- [JWT filter](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/security/JwtAuthenticationFilter.java): `src/main/java/com/kero/flowpay/security/JwtAuthenticationFilter.java`
- [JWT service](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/security/JwtService.java): `src/main/java/com/kero/flowpay/security/JwtService.java`

### Wallet operations

- [Wallet operations](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/service/WalletService.java): `src/main/java/com/kero/flowpay/service/WalletService.java`

### Persistence model

- [User entity](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/model/User.java): `src/main/java/com/kero/flowpay/model/User.java`
- [Wallet entity](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/model/Wallet.java): `src/main/java/com/kero/flowpay/model/Wallet.java`
- [Transaction entity](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/model/Transaction.java): `src/main/java/com/kero/flowpay/model/Transaction.java`
- [Transaction type](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/model/TransactionType.java): `src/main/java/com/kero/flowpay/model/TransactionType.java`
- [Transaction status](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/model/TransactionStatus.java): `src/main/java/com/kero/flowpay/model/TransactionStatus.java`
- [User repository](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/repository/UserRepository.java): `src/main/java/com/kero/flowpay/repository/UserRepository.java`
- [Wallet repository](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/repository/WalletRepository.java): `src/main/java/com/kero/flowpay/repository/WalletRepository.java`
- [Transaction repository](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/java/com/kero/flowpay/repository/TransactionRepository.java): `src/main/java/com/kero/flowpay/repository/TransactionRepository.java`
- [SQL schema](https://github.com/kerolos-nashat/flowpay/blob/main/src/main/resources/db/migration/V1__initial_schema.sql): `src/main/resources/db/migration/V1__initial_schema.sql`

### Other components

- **API client**
- **Relational database**

## Connections

- API client → Auth endpoints: requests (evidence: `src/main/java/com/kero/flowpay/controller/AuthController.java`)
- API client → User endpoints: requests (evidence: `src/main/java/com/kero/flowpay/controller/UserController.java`)
- API client → Wallet endpoints: requests (evidence: `src/main/java/com/kero/flowpay/controller/WalletController.java`)
- Auth endpoints → Authentication: delegates (evidence: `src/main/java/com/kero/flowpay/controller/AuthController.java`)
- User endpoints → User registration: delegates (evidence: `src/main/java/com/kero/flowpay/controller/UserController.java`)
- Wallet endpoints → Wallet operations: delegates (evidence: `src/main/java/com/kero/flowpay/controller/WalletController.java`)
- Authentication → User repository: looks up user (evidence: `src/main/java/com/kero/flowpay/service/AuthService.java`)
- Authentication → JWT service: generates token (evidence: `src/main/java/com/kero/flowpay/service/AuthService.java`)
- User registration → User repository: creates and reads (evidence: `src/main/java/com/kero/flowpay/service/UserService.java`)
- User registration → Wallet repository: creates wallet (evidence: `src/main/java/com/kero/flowpay/service/UserService.java`)
- Security configuration → JWT filter: configures (evidence: `src/main/java/com/kero/flowpay/config/SecurityConfig.java`)
- Security configuration → JWT service: configures (evidence: `src/main/java/com/kero/flowpay/config/SecurityConfig.java`)
- JWT filter → JWT service: validates token (evidence: `src/main/java/com/kero/flowpay/security/JwtAuthenticationFilter.java`)
- Wallet operations → Wallet repository: reads and updates (evidence: `src/main/java/com/kero/flowpay/service/WalletService.java`)
- Wallet operations → Transaction repository: records and reads (evidence: `src/main/java/com/kero/flowpay/service/WalletService.java`)
- User repository → User entity: persists (evidence: `src/main/java/com/kero/flowpay/repository/UserRepository.java`)
- Wallet repository → Wallet entity: persists (evidence: `src/main/java/com/kero/flowpay/repository/WalletRepository.java`)
- Transaction repository → Transaction entity: persists (evidence: `src/main/java/com/kero/flowpay/repository/TransactionRepository.java`)
- Transaction entity → Transaction type: uses enum (evidence: `src/main/java/com/kero/flowpay/model/Transaction.java`)
- Transaction entity → Transaction status: uses enum (evidence: `src/main/java/com/kero/flowpay/model/Transaction.java`)
- Transaction entity → Wallet entity: belongs to wallet (evidence: `src/main/java/com/kero/flowpay/model/Transaction.java`)
- Wallet entity → User entity: belongs to user (evidence: `src/main/java/com/kero/flowpay/model/Wallet.java`)
- SQL schema → Relational database: defines schema
- User repository → Relational database: stores data
- Wallet repository → Relational database: stores data
- Transaction repository → Relational database: stores data
