# antoniusjairus4/palindrome architecture

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

- Interactive diagram: https://gitdiagram.com/antoniusjairus4/palindrome
- Repository: https://github.com/antoniusjairus4/palindrome

## Overview

#### Purpose and deployment shape
This is a personal-finance/wealth-management system: a React client supports dashboards, transactions, assets, household sharing, subscriptions, tax, trips, portfolio views, and an advisor; a Node/Express API owns authenticated financial workflows and persistence. Firebase Hosting deploys the client, while Render configuration suggests server hosting. Paths: `client/src/main.jsx`, `server/server.js`, `firebase.json`, `render.yaml`.

#### Client application shell
Vite boots a React SPA. `App.jsx` likely composes navigation and page/module routing, with dashboard and landing as primary top-level experiences. Shared contexts carry cross-cutting UI state including currency, theme, UX mode, confirmation/error handling, and WebSocket state. Paths: `client/src/main.jsx`, `client/src/App.jsx`, `client/src/pages/Dashboard.jsx`, `client/src/context/WebSocketContext.jsx`.

#### Finance dashboard and domain modules
The dashboard is assembled from domain modules for transaction entry/history, assets, analytics, subscriptions, wealth targets, household, splits, and real-time net worth. Reusable dashboard layout and visual widgets separate page composition from financial views. Paths: `client/src/modules/CoreDashboard.jsx`, `client/src/modules/Transactions.jsx`, `client/src/modules/Assets.jsx`, `client/src/components/DashboardLayout.jsx`.

#### API boundary, authentication, and validation
Express routes divide the API by business domain; controllers implement request workflows. Authentication and security middleware guard server operations, while schemas validate action and transaction payloads before mutation. Paths: `server/server.js`, `server/routes/transactionRoutes.js`, `server/controllers/transactionController.js`, `server/middleware/authMiddleware.js`, `server/schemas/transactionSchemas.js`.

#### Persistence and financial ledger
The server models transactions, assets, subscriptions, tax records, household state, split transactions, and dashboard aggregates. The transaction/ledger paths are the central source-of-truth boundary; reconciliation and normalization utilities support consistent balances and canonicalized input. Paths: `server/models/Transaction.js`, `server/models/DashboardAggregate.js`, `server/controllers/ledgerController.js`, `server/utils/balanceReconciliation.js`, `server/utils/normalizer.js`.

#### Asynchronous intelligence and advisor workflows
Action and inference queues decouple background work from request handling. Advisor routes/controllers use advisor engine/chat utilities and persist suggestions; the client exposes advisor chat/cards. A separate Python application contains ML inference, implying an internal or deployable inference-service boundary. Paths: `server/queues/actionQueue.js`, `server/queues/inferenceQueue.js`, `server/controllers/advisorController.js`, `server/utils/advisorEngine.js`, `app/main.py`, `app/ml/inference.py`.

#### External data and client-side processing
Market and FX functionality are represented at both API and client utility layers, likely allowing portfolio valuation in the UI while server controllers/services obtain authoritative data. Receipt scanning performs browser-side OCR with bundled Tesseract WASM/language assets; its result feeds expense/transaction creation. Paths: `server/controllers/marketController.js`, `server/utils/fxService.js`, `client/src/utils/marketEngine.js`, `client/src/components/ReceiptScanner.jsx`, `client/public/tesseract/tesseract-core.wasm`.

#### Real-time and operational integrations
Client hooks for dashboard sockets, transactions, and net worth indicate live update flow from server-side financial mutations to active dashboard views. Email, encryption, asset streaming, and Firebase deployment are material operational integrations. Paths: `client/src/hooks/useDashboardSocket.js`, `client/src/hooks/useRealTimeNetWorth.js`, `server/utils/emailService.js`, `server/utils/encryption.js`, `.github/workflows/deploy.yml`.

Main entry points: [`client/src/modules/CoreDashboard.jsx`](https://github.com/antoniusjairus4/palindrome/blob/main/client/src/modules/CoreDashboard.jsx) (Dashboard composition), [`server/controllers/transactionController.js`](https://github.com/antoniusjairus4/palindrome/blob/main/server/controllers/transactionController.js) (Transaction workflow), [`server/controllers/ledgerController.js`](https://github.com/antoniusjairus4/palindrome/blob/main/server/controllers/ledgerController.js) (Ledger workflow), [`server/server.js`](https://github.com/antoniusjairus4/palindrome/blob/main/server/server.js) (Express API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_spa["React SPA shell<br/>Vite/React<br/>[main.jsx]"]
  node_dashboard["Dashboard composition<br/>dashboard module<br/>[CoreDashboard.jsx]"]
  node_transactions_ui["Transactions UI<br/>domain module<br/>[Transactions.jsx]"]
  node_assets_ui["Assets UI<br/>domain module<br/>[Assets.jsx]"]
  node_realtime_client["Live dashboard updates<br/>React socket hook"]
  node_receipt_scanner["Receipt scanner<br/>browser OCR<br/>[ReceiptScanner.jsx]"]
  node_market_client["Client market valuation<br/>market utility<br/>[marketEngine.js]"]
end

subgraph group_api["Node API"]
  node_api_server["Express API<br/>Node/Express<br/>[server.js]"]
  node_auth["Auth &amp; security<br/>middleware<br/>[authMiddleware.js]"]
  node_transaction_flow["Transaction workflow<br/>route/controller"]
  node_transaction_schema["Transaction validation<br/>schema"]
  node_advisor["Advisor workflow<br/>controller/engine"]
  node_market_fx["Market &amp; FX service<br/>controller/service"]
end

subgraph group_data["Ledger &amp; background work"]
  node_ledger["Ledger workflow<br/>controller"]
  node_financial_models[("Financial records<br/>persistence model<br/>[Transaction.js]")]
  node_dashboard_aggregate[("Dashboard aggregates<br/>persistence model")]
  node_reconciliation["Balance reconciliation<br/>ledger utility"]
  node_action_queue["Action queue<br/>background queue<br/>[actionQueue.js]"]
  node_inference_queue["Inference queue<br/>background queue<br/>[inferenceQueue.js]"]
end

subgraph group_ml["ML inference"]
  node_ml_service{{"Python inference service<br/>ML service<br/>[main.py]"}}
end

subgraph group_ops["Deployment &amp; integrations"]
  node_hosting["Client deployment<br/>Firebase Hosting<br/>[firebase.json]"]
  node_deploy_pipeline["Deployment pipeline<br/>GitHub Actions<br/>[deploy.yml]"]
end

node_spa -->|"renders"| node_dashboard
node_dashboard -->|"composes"| node_transactions_ui
node_dashboard -->|"composes"| node_assets_ui
node_dashboard -->|"subscribes through"| node_realtime_client
node_receipt_scanner -->|"supplies extracted expenses"| node_transactions_ui
node_market_client -->|"gets market data"| node_market_fx
node_spa -->|"API requests"| node_api_server
node_realtime_client -->|"socket connection"| node_api_server
node_api_server -->|"guards with"| node_auth
node_auth -->|"authorizes"| node_transaction_flow
node_transaction_flow -->|"validates with"| node_transaction_schema
node_transaction_flow -->|"posts mutations"| node_ledger
node_ledger -->|"reads and writes"| node_financial_models
node_ledger -->|"updates"| node_dashboard_aggregate
node_ledger -->|"reconciles via"| node_reconciliation
node_transaction_flow -.->|"enqueues follow-up work"| node_action_queue
node_advisor -.->|"queues inference"| node_inference_queue
node_inference_queue -.->|"dispatches"| node_ml_service
node_api_server -->|"serves advisor requests"| node_advisor
node_deploy_pipeline -->|"deploys client"| node_hosting
node_hosting -->|"hosts"| node_spa

click node_spa "https://github.com/antoniusjairus4/palindrome/blob/main/client/src/main.jsx"
click node_dashboard "https://github.com/antoniusjairus4/palindrome/blob/main/client/src/modules/CoreDashboard.jsx"
click node_transactions_ui "https://github.com/antoniusjairus4/palindrome/blob/main/client/src/modules/Transactions.jsx"
click node_assets_ui "https://github.com/antoniusjairus4/palindrome/blob/main/client/src/modules/Assets.jsx"
click node_realtime_client "https://github.com/antoniusjairus4/palindrome/blob/main/client/src/hooks/useDashboardSocket.js"
click node_receipt_scanner "https://github.com/antoniusjairus4/palindrome/blob/main/client/src/components/ReceiptScanner.jsx"
click node_market_client "https://github.com/antoniusjairus4/palindrome/blob/main/client/src/utils/marketEngine.js"
click node_api_server "https://github.com/antoniusjairus4/palindrome/blob/main/server/server.js"
click node_auth "https://github.com/antoniusjairus4/palindrome/blob/main/server/middleware/authMiddleware.js"
click node_transaction_flow "https://github.com/antoniusjairus4/palindrome/blob/main/server/controllers/transactionController.js"
click node_transaction_schema "https://github.com/antoniusjairus4/palindrome/blob/main/server/schemas/transactionSchemas.js"
click node_ledger "https://github.com/antoniusjairus4/palindrome/blob/main/server/controllers/ledgerController.js"
click node_financial_models "https://github.com/antoniusjairus4/palindrome/blob/main/server/models/Transaction.js"
click node_dashboard_aggregate "https://github.com/antoniusjairus4/palindrome/blob/main/server/models/DashboardAggregate.js"
click node_reconciliation "https://github.com/antoniusjairus4/palindrome/blob/main/server/utils/balanceReconciliation.js"
click node_action_queue "https://github.com/antoniusjairus4/palindrome/blob/main/server/queues/actionQueue.js"
click node_inference_queue "https://github.com/antoniusjairus4/palindrome/blob/main/server/queues/inferenceQueue.js"
click node_advisor "https://github.com/antoniusjairus4/palindrome/blob/main/server/controllers/advisorController.js"
click node_ml_service "https://github.com/antoniusjairus4/palindrome/blob/main/app/main.py"
click node_market_fx "https://github.com/antoniusjairus4/palindrome/blob/main/server/controllers/marketController.js"
click node_hosting "https://github.com/antoniusjairus4/palindrome/blob/main/firebase.json"
click node_deploy_pipeline "https://github.com/antoniusjairus4/palindrome/blob/main/.github/workflows/deploy.yml"

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_spa,node_dashboard,node_transactions_ui,node_assets_ui,node_realtime_client,node_receipt_scanner,node_market_client toneBlue
class node_api_server,node_auth,node_transaction_flow,node_transaction_schema,node_advisor,node_market_fx toneAmber
class node_ledger,node_financial_models,node_dashboard_aggregate,node_reconciliation,node_action_queue,node_inference_queue toneMint
class node_ml_service toneRose
class node_hosting,node_deploy_pipeline toneIndigo
```

## Components

### React client

- [React SPA shell](https://github.com/antoniusjairus4/palindrome/blob/main/client/src/main.jsx): Vite/React · Bootstraps navigation, pages, and shared UI state. · `client/src/main.jsx`
- [Dashboard composition](https://github.com/antoniusjairus4/palindrome/blob/main/client/src/modules/CoreDashboard.jsx): dashboard module · Composes financial views and reusable layout. · `client/src/modules/CoreDashboard.jsx`
- [Transactions UI](https://github.com/antoniusjairus4/palindrome/blob/main/client/src/modules/Transactions.jsx): domain module · `client/src/modules/Transactions.jsx`
- [Assets UI](https://github.com/antoniusjairus4/palindrome/blob/main/client/src/modules/Assets.jsx): domain module · `client/src/modules/Assets.jsx`
- [Live dashboard updates](https://github.com/antoniusjairus4/palindrome/blob/main/client/src/hooks/useDashboardSocket.js): React socket hook · `client/src/hooks/useDashboardSocket.js`
- [Receipt scanner](https://github.com/antoniusjairus4/palindrome/blob/main/client/src/components/ReceiptScanner.jsx): browser OCR · Extracts expense data before transaction creation. · `client/src/components/ReceiptScanner.jsx`
- [Client market valuation](https://github.com/antoniusjairus4/palindrome/blob/main/client/src/utils/marketEngine.js): market utility · `client/src/utils/marketEngine.js`

### Node API

- [Express API](https://github.com/antoniusjairus4/palindrome/blob/main/server/server.js): Node/Express · Authenticated boundary for financial workflows. · `server/server.js`
- [Auth & security](https://github.com/antoniusjairus4/palindrome/blob/main/server/middleware/authMiddleware.js): middleware · `server/middleware/authMiddleware.js`
- [Transaction workflow](https://github.com/antoniusjairus4/palindrome/blob/main/server/controllers/transactionController.js): route/controller · Validates and applies transaction mutations. · `server/controllers/transactionController.js`
- [Transaction validation](https://github.com/antoniusjairus4/palindrome/blob/main/server/schemas/transactionSchemas.js): schema · `server/schemas/transactionSchemas.js`
- [Advisor workflow](https://github.com/antoniusjairus4/palindrome/blob/main/server/controllers/advisorController.js): controller/engine · Creates and persists advisor suggestions. · `server/controllers/advisorController.js`
- [Market & FX service](https://github.com/antoniusjairus4/palindrome/blob/main/server/controllers/marketController.js): controller/service · Provides authoritative market and exchange data. · `server/controllers/marketController.js`

### Ledger & background work

- [Ledger workflow](https://github.com/antoniusjairus4/palindrome/blob/main/server/controllers/ledgerController.js): controller · Maintains balances and ledger-facing operations. · `server/controllers/ledgerController.js`
- [Financial records](https://github.com/antoniusjairus4/palindrome/blob/main/server/models/Transaction.js): persistence model · Transactions are the central financial source of truth. · `server/models/Transaction.js`
- [Dashboard aggregates](https://github.com/antoniusjairus4/palindrome/blob/main/server/models/DashboardAggregate.js): persistence model · `server/models/DashboardAggregate.js`
- [Balance reconciliation](https://github.com/antoniusjairus4/palindrome/blob/main/server/utils/balanceReconciliation.js): ledger utility · `server/utils/balanceReconciliation.js`
- [Action queue](https://github.com/antoniusjairus4/palindrome/blob/main/server/queues/actionQueue.js): background queue · `server/queues/actionQueue.js`
- [Inference queue](https://github.com/antoniusjairus4/palindrome/blob/main/server/queues/inferenceQueue.js): background queue · `server/queues/inferenceQueue.js`

### ML inference

- [Python inference service](https://github.com/antoniusjairus4/palindrome/blob/main/app/main.py): ML service · Provides asynchronous model inference. · `app/main.py`

### Deployment & integrations

- [Client deployment](https://github.com/antoniusjairus4/palindrome/blob/main/firebase.json): Firebase Hosting · `firebase.json`
- [Deployment pipeline](https://github.com/antoniusjairus4/palindrome/blob/main/.github/workflows/deploy.yml): GitHub Actions · `.github/workflows/deploy.yml`

## Connections

- React SPA shell → Dashboard composition: renders
- Dashboard composition → Transactions UI: composes
- Dashboard composition → Assets UI: composes
- Dashboard composition → Live dashboard updates: subscribes through
- Receipt scanner → Transactions UI: supplies extracted expenses
- Client market valuation → Market & FX service: gets market data
- React SPA shell → Express API: API requests
- Live dashboard updates → Express API: socket connection
- Express API → Auth & security: guards with
- Auth & security → Transaction workflow: authorizes
- Transaction workflow → Transaction validation: validates with
- Transaction workflow → Ledger workflow: posts mutations
- Ledger workflow → Financial records: reads and writes
- Ledger workflow → Dashboard aggregates: updates
- Ledger workflow → Balance reconciliation: reconciles via
- Transaction workflow → Action queue: enqueues follow-up work
- Advisor workflow → Inference queue: queues inference
- Inference queue → Python inference service: dispatches
- Express API → Advisor workflow: serves advisor requests
- Deployment pipeline → Client deployment: deploys client
- Client deployment → React SPA shell: hosts
