# vamsiram07/payeasy architecture

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

- Interactive diagram: https://gitdiagram.com/vamsiram07/payeasy
- Repository: https://github.com/vamsiram07/payeasy

## Overview

PayEasy is a wallet-backed payment service. A merchant or client initializes a transaction, receives a payment link, and the payer validates an account, authenticates by PIN or emailed OTP, then submits payment; the service debits the payer and redirects to the callback. A separate credit endpoint credits the recipient, while account users can register, log in, and review transactions. The source also exposes recharge screens, but the sampled routes do not show recharge processing. Wiring is based on sampled source; no README was provided.

Main entry points: [`app.js`](https://github.com/vamsiram07/payeasy/blob/master/app.js) (Express app), [`database/models/transactionModel.js`](https://github.com/vamsiram07/payeasy/blob/master/database/models/transactionModel.js) (Transaction model), [`controllers/user.js`](https://github.com/vamsiram07/payeasy/blob/master/controllers/user.js) (Account routes), [`database/models/userModel.js`](https://github.com/vamsiram07/payeasy/blob/master/database/models/userModel.js) (User model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_payments["Payment flow"]
  node_app["Express app<br/>[app.js]"]
  node_txroutes["Transaction routes<br/>[transaction.js]"]
  node_txhandler["Transaction creation<br/>[transactions.js]"]
  node_auth["Payment validation and auth<br/>[app.js]"]
  node_settlement["Payment processing<br/>[app.js]"]
  node_credit["Recipient credit / cancel<br/>[transaction.js]"]
end

subgraph group_accounts["Accounts"]
  node_useroutes["Account routes<br/>[user.js]"]
  node_userhandler["User operations<br/>[userHandlers.js]"]
  node_dashboard["Dashboard lookup<br/>[app.js]"]
end

subgraph group_data["Persistence"]
  node_usermodel[("User model<br/>[userModel.js]")]
  node_txmodel[("Transaction model")]
  node_dbconnect["Mongo connection<br/>[mongodb.js]"]
end

subgraph group_presentation["Web views"]
  node_views["Pug views"]
  node_public["Static assets<br/>[styles.css]"]
end

node_client(("Merchant / client"))
node_payer(("Payer"))
node_mail(("Gmail SMTP"))
node_mongo[("MongoDB")]

node_client -->|"initializes transaction"| node_txroutes
node_txroutes -->|"creates transaction"| node_txhandler
node_txhandler -->|"writes transaction"| node_txmodel
node_txroutes -->|"loads transaction"| node_txmodel
node_txroutes -->|"renders payment"| node_views
node_payer -->|"submits payment details"| node_app
node_app -->|"handles validation and auth"| node_auth
node_auth -->|"loads payer"| node_usermodel
node_auth -->|"reads and updates transaction"| node_txmodel
node_auth -->|"sends OTP"| node_mail
node_auth -->|"renders auth steps"| node_views
node_app -->|"handles payment"| node_settlement
node_settlement -->|"debits balance"| node_usermodel
node_settlement -->|"loads transaction"| node_txmodel
node_settlement -->|"renders result"| node_views
node_settlement -->|"redirects to callback"| node_client
node_client -->|"requests credit or cancel"| node_credit
node_credit -->|"updates transaction"| node_txmodel
node_credit -->|"credits or refunds balance"| node_usermodel
node_credit -->|"returns callback or response"| node_client
node_payer -->|"registers or logs in"| node_useroutes
node_useroutes -->|"creates or looks up user"| node_userhandler
node_userhandler -->|"writes or reads user"| node_usermodel
node_useroutes -->|"loads dashboard user"| node_usermodel
node_useroutes -->|"loads user transactions"| node_txmodel
node_useroutes -->|"renders account pages"| node_views
node_payer -->|"opens dashboard"| node_app
node_app -->|"handles dashboard request"| node_dashboard
node_dashboard -->|"loads user"| node_usermodel
node_dashboard -->|"loads transactions"| node_txmodel
node_dashboard -->|"renders dashboard"| node_views
node_app -->|"mounts routes"| node_txroutes
node_app -->|"mounts routes"| node_useroutes
node_app -->|"connects database"| node_dbconnect
node_dbconnect -->|"connects"| node_mongo
node_app -->|"renders home page"| node_views
node_payer -->|"loads web assets"| node_app
node_app -->|"serves static files"| node_public

click node_app "https://github.com/vamsiram07/payeasy/blob/master/app.js"
click node_txroutes "https://github.com/vamsiram07/payeasy/blob/master/controllers/transaction.js"
click node_txhandler "https://github.com/vamsiram07/payeasy/blob/master/handlers/transactions.js"
click node_auth "https://github.com/vamsiram07/payeasy/blob/master/app.js"
click node_settlement "https://github.com/vamsiram07/payeasy/blob/master/app.js"
click node_credit "https://github.com/vamsiram07/payeasy/blob/master/controllers/transaction.js"
click node_useroutes "https://github.com/vamsiram07/payeasy/blob/master/controllers/user.js"
click node_userhandler "https://github.com/vamsiram07/payeasy/blob/master/handlers/userHandlers.js"
click node_dashboard "https://github.com/vamsiram07/payeasy/blob/master/app.js"
click node_usermodel "https://github.com/vamsiram07/payeasy/blob/master/database/models/userModel.js"
click node_txmodel "https://github.com/vamsiram07/payeasy/blob/master/database/models/transactionModel.js"
click node_dbconnect "https://github.com/vamsiram07/payeasy/blob/master/database/mongodb.js"
click node_views "https://github.com/vamsiram07/payeasy/tree/master/views"
click node_public "https://github.com/vamsiram07/payeasy/blob/master/public/styles.css"

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_app,node_txroutes,node_txhandler,node_auth,node_settlement,node_credit,node_client toneBlue
class node_useroutes,node_userhandler,node_dashboard,node_mongo toneAmber
class node_usermodel,node_txmodel,node_dbconnect toneMint
class node_views,node_public toneRose
class node_payer,node_mail toneIndigo
```

## Components

### Payment flow

- [Express app](https://github.com/vamsiram07/payeasy/blob/master/app.js): `app.js`
- [Transaction routes](https://github.com/vamsiram07/payeasy/blob/master/controllers/transaction.js): `controllers/transaction.js`
- [Transaction creation](https://github.com/vamsiram07/payeasy/blob/master/handlers/transactions.js): `handlers/transactions.js`
- [Payment validation and auth](https://github.com/vamsiram07/payeasy/blob/master/app.js): `app.js`
- [Payment processing](https://github.com/vamsiram07/payeasy/blob/master/app.js): `app.js`
- [Recipient credit / cancel](https://github.com/vamsiram07/payeasy/blob/master/controllers/transaction.js): `controllers/transaction.js`

### Accounts

- [Account routes](https://github.com/vamsiram07/payeasy/blob/master/controllers/user.js): `controllers/user.js`
- [User operations](https://github.com/vamsiram07/payeasy/blob/master/handlers/userHandlers.js): `handlers/userHandlers.js`
- [Dashboard lookup](https://github.com/vamsiram07/payeasy/blob/master/app.js): `app.js`

### Persistence

- [User model](https://github.com/vamsiram07/payeasy/blob/master/database/models/userModel.js): `database/models/userModel.js`
- [Transaction model](https://github.com/vamsiram07/payeasy/blob/master/database/models/transactionModel.js): `database/models/transactionModel.js`
- [Mongo connection](https://github.com/vamsiram07/payeasy/blob/master/database/mongodb.js): `database/mongodb.js`

### Web views

- [Pug views](https://github.com/vamsiram07/payeasy/tree/master/views): `views`
- [Static assets](https://github.com/vamsiram07/payeasy/blob/master/public/styles.css): `public/styles.css`

### Other components

- **Merchant / client**
- **Payer**
- **Gmail SMTP**
- **MongoDB**

## Connections

- Merchant / client → Transaction routes: initializes transaction
- Transaction routes → Transaction creation: creates transaction
- Transaction creation → Transaction model: writes transaction
- Transaction routes → Transaction model: loads transaction
- Transaction routes → Pug views: renders payment
- Payer → Express app: submits payment details
- Express app → Payment validation and auth: handles validation and auth
- Payment validation and auth → User model: loads payer
- Payment validation and auth → Transaction model: reads and updates transaction
- Payment validation and auth → Gmail SMTP: sends OTP
- Payment validation and auth → Pug views: renders auth steps
- Express app → Payment processing: handles payment
- Payment processing → User model: debits balance
- Payment processing → Transaction model: loads transaction
- Payment processing → Pug views: renders result
- Payment processing → Merchant / client: redirects to callback
- Merchant / client → Recipient credit / cancel: requests credit or cancel
- Recipient credit / cancel → Transaction model: updates transaction
- Recipient credit / cancel → User model: credits or refunds balance
- Recipient credit / cancel → Merchant / client: returns callback or response
- Payer → Account routes: registers or logs in
- Account routes → User operations: creates or looks up user
- User operations → User model: writes or reads user
- Account routes → User model: loads dashboard user
- Account routes → Transaction model: loads user transactions
- Account routes → Pug views: renders account pages
- Payer → Express app: opens dashboard
- Express app → Dashboard lookup: handles dashboard request
- Dashboard lookup → User model: loads user
- Dashboard lookup → Transaction model: loads transactions
- Dashboard lookup → Pug views: renders dashboard
- Express app → Transaction routes: mounts routes
- Express app → Account routes: mounts routes
- Express app → Mongo connection: connects database
- Mongo connection → MongoDB: connects
- Express app → Pug views: renders home page
- Payer → Express app: loads web assets
- Express app → Static assets: serves static files
