# ashfak99/paysim architecture

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

- Interactive diagram: https://gitdiagram.com/ashfak99/paysim
- Repository: https://github.com/ashfak99/paysim

## Overview

This repository is a small interactive wallet/account prototype: a user enters account actions in a command-line menu, which creates account IDs and invokes account or balance services. Account operations maintain in-memory user and fund lists; the balance operation reads the fund list. Although the README names AI fraud detection and real-time payments, the provided tree and source excerpts show no such implementation. Evidence is limited to the README and sampled source; transfer-related types and ID generation exist, but no transfer workflow is shown.

Main entry points: [`server/src/main.py`](https://github.com/ashfak99/paysim/blob/main/server/src/main.py) (Command menu), [`server/src/repository/user_repo.py`](https://github.com/ashfak99/paysim/blob/main/server/src/repository/user_repo.py) (Account repository), [`server/src/repository/fund_repo.py`](https://github.com/ashfak99/paysim/blob/main/server/src/repository/fund_repo.py) (Fund repository), [`server/src/services/user_services.py`](https://github.com/ashfak99/paysim/blob/main/server/src/services/user_services.py) (Account operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI interface"]
  node_menu["Command menu<br/>[main.py]"]
  node_account_id["Account ID generator<br/>[_id_generator.py]"]
end

subgraph group_services["Account services"]
  node_user_service["Account operations<br/>[user_services.py]"]
  node_fund_service["Balance lookup<br/>[fund_services.py]"]
end

subgraph group_state["Wallet state"]
  node_user_model["User record<br/>[user_model.py]"]
  node_fund_model["Fund and transfer types<br/>[fund_model.py]"]
  node_user_repo["Account repository<br/>[user_repo.py]"]
  node_fund_repo["Fund repository<br/>[fund_repo.py]"]
end

node_customer(("Account user"))

node_customer -->|"chooses actions"| node_menu
node_menu -->|"generates ID"| node_account_id
node_menu -->|"creates record"| node_user_model
node_menu -->|"requests account action"| node_user_service
node_menu -->|"requests balance"| node_fund_service
node_user_service -->|"manages accounts"| node_user_repo
node_user_repo -->|"stores users"| node_user_model
node_user_repo -->|"creates initial fund"| node_fund_model
node_user_repo -->|"adds initial funds"| node_fund_repo
node_fund_service -->|"checks balance"| node_fund_repo
node_fund_repo -->|"returns fund record"| node_fund_model

click node_menu "https://github.com/ashfak99/paysim/blob/main/server/src/main.py"
click node_account_id "https://github.com/ashfak99/paysim/blob/main/server/src/utils/_id_generator.py"
click node_user_service "https://github.com/ashfak99/paysim/blob/main/server/src/services/user_services.py"
click node_fund_service "https://github.com/ashfak99/paysim/blob/main/server/src/services/fund_services.py"
click node_user_model "https://github.com/ashfak99/paysim/blob/main/server/src/model/user_model.py"
click node_fund_model "https://github.com/ashfak99/paysim/blob/main/server/src/model/fund_model.py"
click node_user_repo "https://github.com/ashfak99/paysim/blob/main/server/src/repository/user_repo.py"
click node_fund_repo "https://github.com/ashfak99/paysim/blob/main/server/src/repository/fund_repo.py"

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_menu,node_account_id,node_customer toneBlue
class node_user_service,node_fund_service toneAmber
class node_user_model,node_fund_model,node_user_repo,node_fund_repo toneMint
```

## Components

### CLI interface

- [Command menu](https://github.com/ashfak99/paysim/blob/main/server/src/main.py): `server/src/main.py`
- [Account ID generator](https://github.com/ashfak99/paysim/blob/main/server/src/utils/_id_generator.py): `server/src/utils/_id_generator.py`

### Account services

- [Account operations](https://github.com/ashfak99/paysim/blob/main/server/src/services/user_services.py): `server/src/services/user_services.py`
- [Balance lookup](https://github.com/ashfak99/paysim/blob/main/server/src/services/fund_services.py): `server/src/services/fund_services.py`

### Wallet state

- [User record](https://github.com/ashfak99/paysim/blob/main/server/src/model/user_model.py): `server/src/model/user_model.py`
- [Fund and transfer types](https://github.com/ashfak99/paysim/blob/main/server/src/model/fund_model.py): `server/src/model/fund_model.py`
- [Account repository](https://github.com/ashfak99/paysim/blob/main/server/src/repository/user_repo.py): `server/src/repository/user_repo.py`
- [Fund repository](https://github.com/ashfak99/paysim/blob/main/server/src/repository/fund_repo.py): `server/src/repository/fund_repo.py`

### Other components

- **Account user**

## Connections

- Account user → Command menu: chooses actions (evidence: `server/src/main.py`)
- Command menu → Account ID generator: generates ID (evidence: `server/src/main.py`)
- Command menu → User record: creates record (evidence: `server/src/main.py`)
- Command menu → Account operations: requests account action (evidence: `server/src/main.py`)
- Command menu → Balance lookup: requests balance (evidence: `server/src/main.py`)
- Account operations → Account repository: manages accounts (evidence: `server/src/services/user_services.py`)
- Account repository → User record: stores users (evidence: `server/src/repository/user_repo.py`)
- Account repository → Fund and transfer types: creates initial fund (evidence: `server/src/repository/user_repo.py`)
- Account repository → Fund repository: adds initial funds (evidence: `server/src/repository/user_repo.py`)
- Balance lookup → Fund repository: checks balance (evidence: `server/src/services/fund_services.py`)
- Fund repository → Fund and transfer types: returns fund record (evidence: `server/src/repository/fund_repo.py`)
