# miznaansari/epassbook architecture

> Architecture diagram of the GitHub repository miznaansari/epassbook, 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/miznaansari/epassbook
- Repository: https://github.com/miznaansari/epassbook

## Overview

This is a personal expense and e-passbook application: users sign in, manage spending and balance transactions, review or settle loans/lending, and create reusable quick-access purchases. The React app provides authentication and transaction/quick-item state, while an Express API authenticates requests and persists users, transactions, and quick items in MongoDB; Firebase supports Google sign-in. The README is only a Vite template and documents no product capabilities. Some frontend and backend modules were not sampled, so their unverified internal links are omitted.

Main entry points: [`backend/index.js`](https://github.com/miznaansari/epassbook/blob/main/backend/index.js) (Express server), [`src/App.tsx`](https://github.com/miznaansari/epassbook/blob/main/src/App.tsx) (App and routes), [`src/context/TxnState.tsx`](https://github.com/miznaansari/epassbook/blob/main/src/context/TxnState.tsx) (Transaction state), [`backend/route/Quickaccess.js`](https://github.com/miznaansari/epassbook/blob/main/backend/route/Quickaccess.js) (Quick-item service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React application"]
  node_app["App and routes<br/>[App.tsx]"]
  node_login["Login and signup<br/>[Login.tsx]"]
  node_google["Google sign-in<br/>[Google.tsx]"]
  node_dashboard["Dashboard sections<br/>[SectionA.tsx]"]
  node_transaction_list["Transaction list<br/>[SectionC.tsx]"]
  node_transaction_edit["Transaction editing<br/>[EditableModal.tsx]"]
  node_loan_settlement["Loan settlement<br/>[PayBorrowModel.tsx]"]
  node_transaction_actions["Transaction actions"]
  node_quick_ui["Quick purchases<br/>[Quick.tsx]"]
end

subgraph group_state["Client state"]
  node_auth_state["Authentication state<br/>[AuthState.tsx]"]
  node_txn_state["Transaction state<br/>[TxnState.tsx]"]
  node_quick_state["Quick-item state<br/>[QuickState.tsx]"]
end

subgraph group_api["API services"]
  node_api_server["Express server<br/>[index.js]"]
  node_auth_routes["Account and Google auth<br/>[Createuser.js]"]
  node_txn_routes["Transaction service<br/>[Transaction.js]"]
  node_quick_routes["Quick-item service<br/>[Quickaccess.js]"]
  node_jwt_auth["JWT middleware<br/>[auth.js]"]
  node_token_check["Token checker<br/>[tokenchecker.js]"]
end

subgraph group_data["Persistence and identity"]
  node_user_model[("User records<br/>[User.js]")]
  node_txn_model[("Transaction records<br/>[UserTransaction.js]")]
  node_quick_model[("Quick-item records<br/>[QuickAccess.js]")]
end

node_user(("User"))
node_mongodb[("MongoDB")]
node_firebase["Firebase Admin<br/>[firebase.js]"]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"renders"| node_dashboard
node_app -->|"provides state"| node_auth_state
node_app -->|"provides state"| node_txn_state
node_app -->|"provides state"| node_quick_state
node_login -->|"uses"| node_auth_state
node_google -->|"uses"| node_firebase
node_auth_state -->|"requests login"| node_auth_routes
node_auth_state -->|"requests signup"| node_auth_routes
node_dashboard -->|"uses"| node_txn_state
node_dashboard -->|"uses"| node_quick_state
node_transaction_list -->|"fetches transactions"| node_txn_routes
node_transaction_list -->|"opens editor"| node_transaction_edit
node_transaction_list -->|"opens settlement"| node_loan_settlement
node_transaction_edit -->|"uses"| node_txn_state
node_loan_settlement -->|"uses"| node_txn_state
node_transaction_actions -->|"uses"| node_txn_state
node_quick_ui -->|"fetches and adds items"| node_quick_state
node_quick_ui -->|"adds purchase transaction"| node_txn_state
node_api_server -->|"mounts routes"| node_auth_routes
node_api_server -->|"mounts routes"| node_txn_routes
node_api_server -->|"mounts routes"| node_quick_routes
node_api_server -->|"checks token"| node_token_check
node_api_server -->|"connects via"| node_mongodb
node_api_server -->|"verifies identity"| node_firebase
node_auth_routes -->|"reads and writes"| node_user_model
node_txn_routes -->|"protects endpoints"| node_jwt_auth
node_txn_routes -->|"reads and writes"| node_txn_model
node_quick_routes -->|"protects endpoints"| node_jwt_auth
node_quick_routes -->|"reads and writes"| node_quick_model
node_quick_routes -->|"records purchases"| node_txn_model

click node_app "https://github.com/miznaansari/epassbook/blob/main/src/App.tsx"
click node_login "https://github.com/miznaansari/epassbook/blob/main/src/components/Login.tsx"
click node_google "https://github.com/miznaansari/epassbook/blob/main/src/components/Google.tsx"
click node_dashboard "https://github.com/miznaansari/epassbook/blob/main/src/components/SectionA.tsx"
click node_transaction_list "https://github.com/miznaansari/epassbook/blob/main/src/components/SectionC.tsx"
click node_transaction_edit "https://github.com/miznaansari/epassbook/blob/main/src/components/EditableModal.tsx"
click node_loan_settlement "https://github.com/miznaansari/epassbook/blob/main/src/components/PayBorrowModel.tsx"
click node_transaction_actions "https://github.com/miznaansari/epassbook/blob/main/src/components/UpdateAndDeleteModal.tsx"
click node_quick_ui "https://github.com/miznaansari/epassbook/blob/main/src/components/Quick.tsx"
click node_auth_state "https://github.com/miznaansari/epassbook/blob/main/src/context/AuthState.tsx"
click node_txn_state "https://github.com/miznaansari/epassbook/blob/main/src/context/TxnState.tsx"
click node_quick_state "https://github.com/miznaansari/epassbook/blob/main/src/context/QuickState.tsx"
click node_api_server "https://github.com/miznaansari/epassbook/blob/main/backend/index.js"
click node_auth_routes "https://github.com/miznaansari/epassbook/blob/main/backend/route/Createuser.js"
click node_txn_routes "https://github.com/miznaansari/epassbook/blob/main/backend/route/Transaction.js"
click node_quick_routes "https://github.com/miznaansari/epassbook/blob/main/backend/route/Quickaccess.js"
click node_jwt_auth "https://github.com/miznaansari/epassbook/blob/main/backend/middleware/auth.js"
click node_token_check "https://github.com/miznaansari/epassbook/blob/main/backend/middleware/tokenchecker.js"
click node_user_model "https://github.com/miznaansari/epassbook/blob/main/backend/model/User.js"
click node_txn_model "https://github.com/miznaansari/epassbook/blob/main/backend/model/UserTransaction.js"
click node_quick_model "https://github.com/miznaansari/epassbook/blob/main/backend/model/QuickAccess.js"
click node_firebase "https://github.com/miznaansari/epassbook/blob/main/backend/firebase.js"

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_login,node_google,node_dashboard,node_transaction_list,node_transaction_edit,node_loan_settlement,node_transaction_actions,node_quick_ui,node_user toneBlue
class node_auth_state,node_txn_state,node_quick_state,node_mongodb toneAmber
class node_api_server,node_auth_routes,node_txn_routes,node_quick_routes,node_jwt_auth,node_token_check toneMint
class node_user_model,node_txn_model,node_quick_model toneRose
class node_firebase toneTeal
```

## Components

### React application

- [App and routes](https://github.com/miznaansari/epassbook/blob/main/src/App.tsx): `src/App.tsx`
- [Login and signup](https://github.com/miznaansari/epassbook/blob/main/src/components/Login.tsx): `src/components/Login.tsx`
- [Google sign-in](https://github.com/miznaansari/epassbook/blob/main/src/components/Google.tsx): `src/components/Google.tsx`
- [Dashboard sections](https://github.com/miznaansari/epassbook/blob/main/src/components/SectionA.tsx): `src/components/SectionA.tsx`
- [Transaction list](https://github.com/miznaansari/epassbook/blob/main/src/components/SectionC.tsx): `src/components/SectionC.tsx`
- [Transaction editing](https://github.com/miznaansari/epassbook/blob/main/src/components/EditableModal.tsx): `src/components/EditableModal.tsx`
- [Loan settlement](https://github.com/miznaansari/epassbook/blob/main/src/components/PayBorrowModel.tsx): `src/components/PayBorrowModel.tsx`
- [Transaction actions](https://github.com/miznaansari/epassbook/blob/main/src/components/UpdateAndDeleteModal.tsx): `src/components/UpdateAndDeleteModal.tsx`
- [Quick purchases](https://github.com/miznaansari/epassbook/blob/main/src/components/Quick.tsx): `src/components/Quick.tsx`

### Client state

- [Authentication state](https://github.com/miznaansari/epassbook/blob/main/src/context/AuthState.tsx): `src/context/AuthState.tsx`
- [Transaction state](https://github.com/miznaansari/epassbook/blob/main/src/context/TxnState.tsx): `src/context/TxnState.tsx`
- [Quick-item state](https://github.com/miznaansari/epassbook/blob/main/src/context/QuickState.tsx): `src/context/QuickState.tsx`

### API services

- [Express server](https://github.com/miznaansari/epassbook/blob/main/backend/index.js): `backend/index.js`
- [Account and Google auth](https://github.com/miznaansari/epassbook/blob/main/backend/route/Createuser.js): `backend/route/Createuser.js`
- [Transaction service](https://github.com/miznaansari/epassbook/blob/main/backend/route/Transaction.js): `backend/route/Transaction.js`
- [Quick-item service](https://github.com/miznaansari/epassbook/blob/main/backend/route/Quickaccess.js): `backend/route/Quickaccess.js`
- [JWT middleware](https://github.com/miznaansari/epassbook/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Token checker](https://github.com/miznaansari/epassbook/blob/main/backend/middleware/tokenchecker.js): `backend/middleware/tokenchecker.js`

### Persistence and identity

- [User records](https://github.com/miznaansari/epassbook/blob/main/backend/model/User.js): `backend/model/User.js`
- [Transaction records](https://github.com/miznaansari/epassbook/blob/main/backend/model/UserTransaction.js): `backend/model/UserTransaction.js`
- [Quick-item records](https://github.com/miznaansari/epassbook/blob/main/backend/model/QuickAccess.js): `backend/model/QuickAccess.js`

### Other components

- **User**
- **MongoDB**
- [Firebase Admin](https://github.com/miznaansari/epassbook/blob/main/backend/firebase.js): `backend/firebase.js`

## Connections

- User → App and routes: uses
- App and routes → Login and signup: routes to (evidence: `src/App.tsx`)
- App and routes → Dashboard sections: renders (evidence: `src/App.tsx`)
- App and routes → Authentication state: provides state (evidence: `src/App.tsx`)
- App and routes → Transaction state: provides state (evidence: `src/App.tsx`)
- App and routes → Quick-item state: provides state (evidence: `src/App.tsx`)
- Login and signup → Authentication state: uses (evidence: `src/components/Login.tsx`)
- Google sign-in → Firebase Admin: uses (evidence: `src/components/Google.tsx`)
- Authentication state → Account and Google auth: requests login (evidence: `src/context/AuthState.tsx`)
- Authentication state → Account and Google auth: requests signup (evidence: `src/context/AuthState.tsx`)
- Dashboard sections → Transaction state: uses (evidence: `src/components/SectionA.tsx`)
- Dashboard sections → Quick-item state: uses (evidence: `src/components/SectionA.tsx`)
- Transaction list → Transaction service: fetches transactions (evidence: `src/components/SectionC.tsx`)
- Transaction list → Transaction editing: opens editor (evidence: `src/components/SectionC.tsx`)
- Transaction list → Loan settlement: opens settlement (evidence: `src/components/SectionC.tsx`)
- Transaction editing → Transaction state: uses (evidence: `src/components/EditableModal.tsx`)
- Loan settlement → Transaction state: uses (evidence: `src/components/PayBorrowModel.tsx`)
- Transaction actions → Transaction state: uses (evidence: `src/components/UpdateAndDeleteModal.tsx`)
- Quick purchases → Quick-item state: fetches and adds items (evidence: `src/components/Quick.tsx`)
- Quick purchases → Transaction state: adds purchase transaction (evidence: `src/components/Quick.tsx`)
- Express server → Account and Google auth: mounts routes (evidence: `backend/index.js`)
- Express server → Transaction service: mounts routes (evidence: `backend/index.js`)
- Express server → Quick-item service: mounts routes (evidence: `backend/index.js`)
- Express server → Token checker: checks token (evidence: `backend/index.js`)
- Express server → MongoDB: connects via (evidence: `backend/index.js`)
- Express server → Firebase Admin: verifies identity (evidence: `backend/index.js`)
- Account and Google auth → User records: reads and writes (evidence: `backend/route/Createuser.js`)
- Transaction service → JWT middleware: protects endpoints (evidence: `backend/route/Transaction.js`)
- Transaction service → Transaction records: reads and writes (evidence: `backend/route/Transaction.js`)
- Quick-item service → JWT middleware: protects endpoints (evidence: `backend/route/Quickaccess.js`)
- Quick-item service → Quick-item records: reads and writes (evidence: `backend/route/Quickaccess.js`)
- Quick-item service → Transaction records: records purchases (evidence: `backend/route/Quickaccess.js`)
