# rohitsai4429/ledgerline architecture

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

- Interactive diagram: https://gitdiagram.com/rohitsai4429/ledgerline
- Repository: https://github.com/rohitsai4429/ledgerline

## Overview

LedgerLine is an internal financial ledger for account holders, administrators, and auditors. Users authenticate with a password or Google sign-in, verify by email OTP, then manage accounts or perform internal deposits, withdrawals, and transfers; they can review transactions and statements, while oversight roles manage account status and inspect audit events. The backend is documented as a modular FastAPI monolith backed by PostgreSQL. README capabilities fill in important unsampled areas; dashed links mark relationships not established by the excerpts or explicit documentation.

Main entry points: [`frontend/src/api/client.ts`](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/client.ts) (HTTP client), [`frontend/src/hooks/useLedgerData.ts`](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/hooks/useLedgerData.ts) (Ledger data hooks), [`frontend/src/App.tsx`](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/App.tsx) (Application routes), [`backend/app/api/router.py`](https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/api/router.py) (API router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Application routes<br/>[App.tsx]"]
  node_authpages["Sign-in and registration<br/>[AuthPages.tsx]"]
  node_http["HTTP client<br/>[client.ts]"]
  node_shell["Role-based workspace<br/>[AppShell.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
  node_accountspage["Account management<br/>[AccountsPage.tsx]"]
  node_money["Money actions"]
  node_transactions["Transaction history"]
  node_statements["Statements<br/>[StatementsPage.tsx]"]
  node_ledgerdata["Ledger data hooks<br/>[useLedgerData.ts]"]
  node_apiaccounts["Account API<br/>[accounts.ts]"]
  node_apitransactions["Transaction API<br/>[transactions.ts]"]
  node_apistatements["Statement API<br/>[statements.ts]"]
  node_apiaudit["Audit API<br/>[audit.ts]"]
  node_apiadmin["Admin API<br/>[admin.ts]"]
end

subgraph group_identity["Identity and access"]
  node_authstate["Auth session<br/>[AuthProvider.tsx]"]
  node_authapi["Auth API client<br/>[auth.ts]"]
  node_authroutes["Authentication routes<br/>[auth.py]"]
  node_authservice["Authentication service<br/>[auth.py]"]
  node_googleservice["Google identity<br/>[google_auth.py]"]
  node_otpservice["Email OTP<br/>[otp.py]"]
  node_identitymodels["Identity and OTP models<br/>[auth.py]"]
end

subgraph group_ledger["Ledger operations"]
  node_accountroutes["Account routes<br/>[accounts.py]"]
  node_transactionroutes["Transaction routes<br/>[transactions.py]"]
  node_accountsservice["Account service<br/>[accounts.py]"]
  node_transactionsservice["Transaction service<br/>[transactions.py]"]
end

subgraph group_oversight["Oversight and records"]
  node_adminpages["Admin account review<br/>[AdminPages.tsx]"]
  node_auditpage["Audit events<br/>[AuditPage.tsx]"]
  node_auditservice["Audit service<br/>[audit.py]"]
end

subgraph group_backend["Backend platform"]
  node_router["API router<br/>[router.py]"]
  node_models["Ledger and user models"]
  node_repositories["Data repositories"]
end

node_holder(("Account holder"))
node_operator(("Administrator / auditor"))

node_holder -->|"signs in"| node_authpages
node_authpages -->|"starts authentication"| node_authstate
node_authstate -->|"calls"| node_authapi
node_authapi -->|"sends requests"| node_http
node_http -->|"calls auth endpoints"| node_authroutes
node_authpages -.->|"offers Google sign-in"| node_googleservice
node_authroutes -->|"resolves Google identity"| node_googleservice
node_authroutes -.->|"starts verification"| node_otpservice
node_otpservice -.->|"persists challenges"| node_identitymodels
node_googleservice -->|"looks up users"| node_repositories
node_googleservice -->|"records registration"| node_auditservice
node_authstate -->|"provides session"| node_app
node_holder -->|"manages accounts"| node_accountspage
node_holder -->|"moves ledger funds"| node_money
node_money -.->|"loads and mutates data"| node_ledgerdata
node_accountspage -.->|"loads accounts"| node_ledgerdata
node_ledgerdata -->|"calls"| node_apiaccounts
node_ledgerdata -->|"calls"| node_apitransactions
node_ledgerdata -->|"calls"| node_apistatements
node_ledgerdata -->|"calls"| node_apiaudit
node_ledgerdata -->|"calls"| node_apiadmin
node_apiaccounts -.->|"sends requests"| node_http
node_apitransactions -.->|"sends requests"| node_http
node_apistatements -.->|"sends requests"| node_http
node_apiaudit -.->|"sends requests"| node_http
node_apiadmin -.->|"sends requests"| node_http
node_http -.->|"calls API"| node_router
node_router -->|"registers routes"| node_authroutes
node_router -->|"registers routes"| node_accountroutes
node_router -->|"registers routes"| node_transactionroutes
node_accountroutes -.->|"serves account operations"| node_accountsservice
node_transactionroutes -.->|"serves money movement"| node_transactionsservice
node_accountsservice -.->|"uses persistence"| node_repositories
node_transactionsservice -.->|"uses persistence"| node_repositories
node_transactionsservice -.->|"records audit events"| node_auditservice
node_repositories -.->|"persists records"| node_models
node_operator -->|"reviews accounts"| node_adminpages
node_operator -->|"reviews audit trail"| node_auditpage
node_operator -->|"reviews transactions"| node_transactions
node_operator -->|"reviews statements"| node_statements
node_holder -->|"views overview"| node_dashboard
node_holder -->|"reviews activity"| node_transactions
node_holder -->|"reviews statements"| node_statements
node_app -->|"routes to"| node_authpages
node_app -->|"wraps workspace"| node_shell
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_accountspage
node_app -->|"routes to"| node_money

click node_app "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/App.tsx"
click node_authpages "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/AuthPages.tsx"
click node_authstate "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/auth/AuthProvider.tsx"
click node_authapi "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/auth.ts"
click node_http "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/client.ts"
click node_shell "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/components/AppShell.tsx"
click node_dashboard "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/DashboardPage.tsx"
click node_accountspage "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/AccountsPage.tsx"
click node_money "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/MoneyActionPage.tsx"
click node_transactions "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/TransactionsPage.tsx"
click node_statements "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/StatementsPage.tsx"
click node_adminpages "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/AdminPages.tsx"
click node_auditpage "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/AuditPage.tsx"
click node_ledgerdata "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/hooks/useLedgerData.ts"
click node_apiaccounts "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/accounts.ts"
click node_apitransactions "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/transactions.ts"
click node_apistatements "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/statements.ts"
click node_apiaudit "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/audit.ts"
click node_apiadmin "https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/admin.ts"
click node_router "https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/api/router.py"
click node_authroutes "https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/api/routes/auth.py"
click node_accountroutes "https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/api/routes/accounts.py"
click node_transactionroutes "https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/api/routes/transactions.py"
click node_authservice "https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/services/auth.py"
click node_googleservice "https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/services/google_auth.py"
click node_otpservice "https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/services/otp.py"
click node_accountsservice "https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/services/accounts.py"
click node_transactionsservice "https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/services/transactions.py"
click node_auditservice "https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/services/audit.py"
click node_models "https://github.com/rohitsai4429/ledgerline/tree/main/backend/app/models"
click node_identitymodels "https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/models/auth.py"
click node_repositories "https://github.com/rohitsai4429/ledgerline/tree/main/backend/app/repositories"

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_authpages,node_http,node_shell,node_dashboard,node_accountspage,node_money,node_transactions,node_statements,node_ledgerdata,node_apiaccounts,node_apitransactions,node_apistatements,node_apiaudit,node_apiadmin toneBlue
class node_authstate,node_authapi,node_authroutes,node_authservice,node_googleservice,node_otpservice,node_identitymodels toneAmber
class node_accountroutes,node_transactionroutes,node_accountsservice,node_transactionsservice toneMint
class node_adminpages,node_auditpage,node_auditservice toneRose
class node_router,node_models,node_repositories,node_holder,node_operator toneIndigo
```

## Components

### Web application

- [Application routes](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Sign-in and registration](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/AuthPages.tsx): `frontend/src/pages/AuthPages.tsx`
- [HTTP client](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Role-based workspace](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/components/AppShell.tsx): `frontend/src/components/AppShell.tsx`
- [Dashboard](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/DashboardPage.tsx): `frontend/src/pages/DashboardPage.tsx`
- [Account management](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/AccountsPage.tsx): `frontend/src/pages/AccountsPage.tsx`
- [Money actions](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/MoneyActionPage.tsx): `frontend/src/pages/MoneyActionPage.tsx`
- [Transaction history](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/TransactionsPage.tsx): `frontend/src/pages/TransactionsPage.tsx`
- [Statements](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/StatementsPage.tsx): `frontend/src/pages/StatementsPage.tsx`
- [Ledger data hooks](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/hooks/useLedgerData.ts): `frontend/src/hooks/useLedgerData.ts`
- [Account API](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/accounts.ts): `frontend/src/api/accounts.ts`
- [Transaction API](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/transactions.ts): `frontend/src/api/transactions.ts`
- [Statement API](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/statements.ts): `frontend/src/api/statements.ts`
- [Audit API](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/audit.ts): `frontend/src/api/audit.ts`
- [Admin API](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/admin.ts): `frontend/src/api/admin.ts`

### Identity and access

- [Auth session](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/auth/AuthProvider.tsx): `frontend/src/auth/AuthProvider.tsx`
- [Auth API client](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/api/auth.ts): `frontend/src/api/auth.ts`
- [Authentication routes](https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/api/routes/auth.py): `backend/app/api/routes/auth.py`
- [Authentication service](https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/services/auth.py): `backend/app/services/auth.py`
- [Google identity](https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/services/google_auth.py): `backend/app/services/google_auth.py`
- [Email OTP](https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/services/otp.py): `backend/app/services/otp.py`
- [Identity and OTP models](https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/models/auth.py): `backend/app/models/auth.py`

### Ledger operations

- [Account routes](https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/api/routes/accounts.py): `backend/app/api/routes/accounts.py`
- [Transaction routes](https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/api/routes/transactions.py): `backend/app/api/routes/transactions.py`
- [Account service](https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/services/accounts.py): `backend/app/services/accounts.py`
- [Transaction service](https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/services/transactions.py): `backend/app/services/transactions.py`

### Oversight and records

- [Admin account review](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/AdminPages.tsx): `frontend/src/pages/AdminPages.tsx`
- [Audit events](https://github.com/rohitsai4429/ledgerline/blob/main/frontend/src/pages/AuditPage.tsx): `frontend/src/pages/AuditPage.tsx`
- [Audit service](https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/services/audit.py): `backend/app/services/audit.py`

### Backend platform

- [API router](https://github.com/rohitsai4429/ledgerline/blob/main/backend/app/api/router.py): `backend/app/api/router.py`
- [Ledger and user models](https://github.com/rohitsai4429/ledgerline/tree/main/backend/app/models): `backend/app/models`
- [Data repositories](https://github.com/rohitsai4429/ledgerline/tree/main/backend/app/repositories): `backend/app/repositories`

### Other components

- **Account holder**
- **Administrator / auditor**

## Connections

- Account holder → Sign-in and registration: signs in
- Sign-in and registration → Auth session: starts authentication (evidence: `frontend/src/pages/AuthPages.tsx`)
- Auth session → Auth API client: calls (evidence: `frontend/src/auth/AuthProvider.tsx`)
- Auth API client → HTTP client: sends requests (evidence: `frontend/src/api/auth.ts`)
- HTTP client → Authentication routes: calls auth endpoints
- Sign-in and registration → Google identity: offers Google sign-in
- Authentication routes → Google identity: resolves Google identity (evidence: `backend/app/services/google_auth.py`)
- Authentication routes → Email OTP: starts verification
- Email OTP → Identity and OTP models: persists challenges
- Google identity → Data repositories: looks up users (evidence: `backend/app/services/google_auth.py`)
- Google identity → Audit service: records registration (evidence: `backend/app/services/google_auth.py`)
- Auth session → Application routes: provides session (evidence: `frontend/src/App.tsx`)
- Account holder → Account management: manages accounts
- Account holder → Money actions: moves ledger funds
- Money actions → Ledger data hooks: loads and mutates data
- Account management → Ledger data hooks: loads accounts
- Ledger data hooks → Account API: calls (evidence: `frontend/src/hooks/useLedgerData.ts`)
- Ledger data hooks → Transaction API: calls (evidence: `frontend/src/hooks/useLedgerData.ts`)
- Ledger data hooks → Statement API: calls (evidence: `frontend/src/hooks/useLedgerData.ts`)
- Ledger data hooks → Audit API: calls (evidence: `frontend/src/hooks/useLedgerData.ts`)
- Ledger data hooks → Admin API: calls (evidence: `frontend/src/hooks/useLedgerData.ts`)
- Account API → HTTP client: sends requests
- Transaction API → HTTP client: sends requests
- Statement API → HTTP client: sends requests
- Audit API → HTTP client: sends requests
- Admin API → HTTP client: sends requests
- HTTP client → API router: calls API
- API router → Authentication routes: registers routes (evidence: `backend/app/api/router.py`)
- API router → Account routes: registers routes (evidence: `backend/app/api/router.py`)
- API router → Transaction routes: registers routes (evidence: `backend/app/api/router.py`)
- Account routes → Account service: serves account operations
- Transaction routes → Transaction service: serves money movement
- Account service → Data repositories: uses persistence
- Transaction service → Data repositories: uses persistence
- Transaction service → Audit service: records audit events
- Data repositories → Ledger and user models: persists records
- Administrator / auditor → Admin account review: reviews accounts
- Administrator / auditor → Audit events: reviews audit trail
- Administrator / auditor → Transaction history: reviews transactions
- Administrator / auditor → Statements: reviews statements
- Account holder → Dashboard: views overview
- Account holder → Transaction history: reviews activity
- Account holder → Statements: reviews statements
- Application routes → Sign-in and registration: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Role-based workspace: wraps workspace (evidence: `frontend/src/App.tsx`)
- Application routes → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Account management: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Money actions: routes to (evidence: `frontend/src/App.tsx`)
