# sahildhanawadeofficial/latch architecture

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

- Interactive diagram: https://gitdiagram.com/sahildhanawadeofficial/latch
- Repository: https://github.com/sahildhanawadeofficial/latch

## Overview

BioVault-AI combines multi-factor biometric security, transaction risk controls, and financial retrieval/chat capabilities. The main user journey is authentication, followed by dashboard use and PIN/biometric-gated transfers; separate lab and search views expose the AI and retrieval features. The API service is the runtime hub for its Python modules, while the backend also proxies AI requests. Some frontend-to-backend request wiring and unsampled module internals are not shown, so those links are omitted.

Main entry points: [`ai_engine/app.py`](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/app.py) (AI API service), [`frontend/src/App.jsx`](https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/App.jsx) (Application shell), [`backend/controllers/authController.js`](https://github.com/sahildhanawadeofficial/latch/blob/master/backend/controllers/authController.js) (Authentication controller), [`backend/controllers/transactionController.js`](https://github.com/sahildhanawadeofficial/latch/blob/master/backend/controllers/transactionController.js) (Transaction controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client application"]
  node_app["Application shell<br/>[App.jsx]"]
  node_auth_ui["Authentication UI<br/>[AuthModal.jsx]"]
  node_dashboard["Financial dashboard<br/>[Dashboard.jsx]"]
  node_dl_lab["Deep learning lab"]
  node_ir_search["IR search<br/>[IRSearch.jsx]"]
  node_chat_ui["AI chatbot UI<br/>[AIChatbot.jsx]"]
end

subgraph group_security["Identity and security"]
  node_face_biometrics["Face biometrics<br/>[faceBiometrics.js]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.js]"]
  node_auth_controller["Authentication controller<br/>[authController.js]"]
  node_auth_store[("Identity state<br/>[store.js]")]
  node_jwt_keys["JWT key service<br/>[keyService.js]"]
  node_auth_middleware["Token middleware<br/>[authMiddleware.js]"]
  node_email_service["Email service<br/>[emailService.js]"]
end

subgraph group_transactions["Transaction processing"]
  node_tx_routes["Transaction routes"]
  node_tx_controller["Transaction controller"]
  node_tx_store[("Transaction state<br/>[store.js]")]
  node_mongo_models[("Mongo transaction models<br/>[mongoModels.js]")]
end

subgraph group_intelligence["AI and information retrieval"]
  node_ai_proxy["AI proxy routes<br/>[aiProxyRoutes.js]"]
  node_ai_service["AI API service<br/>[app.py]"]
  node_liveness["Liveness classifier<br/>[lstm_liveness.py]"]
  node_anomaly["Anomaly detection"]
  node_gmm["Spending clusters<br/>[gmm_spending.py]"]
  node_vision["Vision pipeline<br/>[vision_pipeline.py]"]
  node_case_studies["Vision case studies"]
  node_crawler["Web crawler<br/>[crawler.py]"]
  node_pagerank["PageRank<br/>[pagerank.py]"]
  node_indexer["MapReduce indexer"]
  node_parallel_ir["Parallel retrieval<br/>[parallel_ir.py]"]
  node_language_ir["Language-model IR"]
  node_ranking_eval["Ranking evaluation<br/>[ranking_eval.py]"]
  node_recommender["Recommender<br/>[recommender.py]"]
  node_entities["Entity extraction"]
  node_semantic_web["Semantic graph<br/>[semantic_web.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_auth_ui
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_dl_lab
node_app -->|"renders"| node_ir_search
node_app -->|"renders"| node_chat_ui
node_auth_ui -->|"uses"| node_face_biometrics
node_dashboard -->|"uses"| node_face_biometrics
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"protects"| node_auth_middleware
node_auth_controller -->|"reads/writes"| node_auth_store
node_auth_controller -->|"loads keys"| node_jwt_keys
node_auth_controller -->|"sends email"| node_email_service
node_auth_middleware -->|"loads keys"| node_jwt_keys
node_tx_routes -->|"dispatches"| node_tx_controller
node_tx_routes -->|"protects"| node_auth_middleware
node_tx_controller -->|"reads/writes"| node_tx_store
node_tx_controller -->|"queries"| node_mongo_models
node_tx_controller -->|"requests risk"| node_ai_service
node_ai_proxy -->|"forwards requests"| node_ai_service
node_ai_service -->|"calls"| node_liveness
node_ai_service -->|"calls"| node_anomaly
node_ai_service -->|"calls"| node_gmm
node_ai_service -->|"calls"| node_vision
node_ai_service -->|"calls"| node_case_studies
node_ai_service -->|"calls"| node_crawler
node_ai_service -->|"calls"| node_pagerank
node_ai_service -->|"calls"| node_indexer
node_ai_service -->|"calls"| node_parallel_ir
node_ai_service -->|"calls"| node_language_ir
node_ai_service -->|"calls"| node_ranking_eval
node_ai_service -->|"calls"| node_recommender
node_ai_service -->|"calls"| node_entities
node_ai_service -->|"calls"| node_semantic_web
node_crawler -->|"refreshes index"| node_indexer
node_crawler -->|"fits corpus"| node_language_ir

click node_app "https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/App.jsx"
click node_auth_ui "https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/components/AuthModal.jsx"
click node_dashboard "https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/pages/Dashboard.jsx"
click node_dl_lab "https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/pages/DeepLearningLab.jsx"
click node_ir_search "https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/pages/IRSearch.jsx"
click node_chat_ui "https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/pages/AIChatbot.jsx"
click node_face_biometrics "https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/utils/faceBiometrics.js"
click node_auth_routes "https://github.com/sahildhanawadeofficial/latch/blob/master/backend/routes/authRoutes.js"
click node_auth_controller "https://github.com/sahildhanawadeofficial/latch/blob/master/backend/controllers/authController.js"
click node_auth_store "https://github.com/sahildhanawadeofficial/latch/blob/master/backend/models/store.js"
click node_jwt_keys "https://github.com/sahildhanawadeofficial/latch/blob/master/backend/services/keyService.js"
click node_auth_middleware "https://github.com/sahildhanawadeofficial/latch/blob/master/backend/middleware/authMiddleware.js"
click node_email_service "https://github.com/sahildhanawadeofficial/latch/blob/master/backend/services/emailService.js"
click node_tx_routes "https://github.com/sahildhanawadeofficial/latch/blob/master/backend/routes/transactionRoutes.js"
click node_tx_controller "https://github.com/sahildhanawadeofficial/latch/blob/master/backend/controllers/transactionController.js"
click node_tx_store "https://github.com/sahildhanawadeofficial/latch/blob/master/backend/models/store.js"
click node_mongo_models "https://github.com/sahildhanawadeofficial/latch/blob/master/backend/models/mongoModels.js"
click node_ai_proxy "https://github.com/sahildhanawadeofficial/latch/blob/master/backend/routes/aiProxyRoutes.js"
click node_ai_service "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/app.py"
click node_liveness "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/lstm_liveness.py"
click node_anomaly "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/autoencoder_anomaly.py"
click node_gmm "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/gmm_spending.py"
click node_vision "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/vision_pipeline.py"
click node_case_studies "https://github.com/sahildhanawadeofficial/latch/tree/master/ai_engine/case_studies"
click node_crawler "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/crawler.py"
click node_pagerank "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/pagerank.py"
click node_indexer "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/mapreduce_indexer.py"
click node_parallel_ir "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/parallel_ir.py"
click node_language_ir "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/language_model_ir.py"
click node_ranking_eval "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/ranking_eval.py"
click node_recommender "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/recommender.py"
click node_entities "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/information_extraction.py"
click node_semantic_web "https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/semantic_web.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_app,node_auth_ui,node_dashboard,node_dl_lab,node_ir_search,node_chat_ui,node_user toneBlue
class node_face_biometrics,node_auth_routes,node_auth_controller,node_auth_store,node_jwt_keys,node_auth_middleware,node_email_service toneAmber
class node_tx_routes,node_tx_controller,node_tx_store,node_mongo_models toneMint
class node_ai_proxy,node_ai_service,node_liveness,node_anomaly,node_gmm,node_vision,node_case_studies,node_crawler,node_pagerank,node_indexer,node_parallel_ir,node_language_ir,node_ranking_eval,node_recommender,node_entities,node_semantic_web toneRose
```

## Components

### Client application

- [Application shell](https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Authentication UI](https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/components/AuthModal.jsx): `frontend/src/components/AuthModal.jsx`
- [Financial dashboard](https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Deep learning lab](https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/pages/DeepLearningLab.jsx): `frontend/src/pages/DeepLearningLab.jsx`
- [IR search](https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/pages/IRSearch.jsx): `frontend/src/pages/IRSearch.jsx`
- [AI chatbot UI](https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/pages/AIChatbot.jsx): `frontend/src/pages/AIChatbot.jsx`

### Identity and security

- [Face biometrics](https://github.com/sahildhanawadeofficial/latch/blob/master/frontend/src/utils/faceBiometrics.js): `frontend/src/utils/faceBiometrics.js`
- [Authentication routes](https://github.com/sahildhanawadeofficial/latch/blob/master/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Authentication controller](https://github.com/sahildhanawadeofficial/latch/blob/master/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Identity state](https://github.com/sahildhanawadeofficial/latch/blob/master/backend/models/store.js): `backend/models/store.js`
- [JWT key service](https://github.com/sahildhanawadeofficial/latch/blob/master/backend/services/keyService.js): `backend/services/keyService.js`
- [Token middleware](https://github.com/sahildhanawadeofficial/latch/blob/master/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [Email service](https://github.com/sahildhanawadeofficial/latch/blob/master/backend/services/emailService.js): `backend/services/emailService.js`

### Transaction processing

- [Transaction routes](https://github.com/sahildhanawadeofficial/latch/blob/master/backend/routes/transactionRoutes.js): `backend/routes/transactionRoutes.js`
- [Transaction controller](https://github.com/sahildhanawadeofficial/latch/blob/master/backend/controllers/transactionController.js): `backend/controllers/transactionController.js`
- [Transaction state](https://github.com/sahildhanawadeofficial/latch/blob/master/backend/models/store.js): `backend/models/store.js`
- [Mongo transaction models](https://github.com/sahildhanawadeofficial/latch/blob/master/backend/models/mongoModels.js): `backend/models/mongoModels.js`

### AI and information retrieval

- [AI proxy routes](https://github.com/sahildhanawadeofficial/latch/blob/master/backend/routes/aiProxyRoutes.js): `backend/routes/aiProxyRoutes.js`
- [AI API service](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/app.py): `ai_engine/app.py`
- [Liveness classifier](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/lstm_liveness.py): `ai_engine/lstm_liveness.py`
- [Anomaly detection](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/autoencoder_anomaly.py): `ai_engine/autoencoder_anomaly.py`
- [Spending clusters](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/gmm_spending.py): `ai_engine/gmm_spending.py`
- [Vision pipeline](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/vision_pipeline.py): `ai_engine/vision_pipeline.py`
- [Vision case studies](https://github.com/sahildhanawadeofficial/latch/tree/master/ai_engine/case_studies): `ai_engine/case_studies`
- [Web crawler](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/crawler.py): `ai_engine/crawler.py`
- [PageRank](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/pagerank.py): `ai_engine/pagerank.py`
- [MapReduce indexer](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/mapreduce_indexer.py): `ai_engine/mapreduce_indexer.py`
- [Parallel retrieval](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/parallel_ir.py): `ai_engine/parallel_ir.py`
- [Language-model IR](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/language_model_ir.py): `ai_engine/language_model_ir.py`
- [Ranking evaluation](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/ranking_eval.py): `ai_engine/ranking_eval.py`
- [Recommender](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/recommender.py): `ai_engine/recommender.py`
- [Entity extraction](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/information_extraction.py): `ai_engine/information_extraction.py`
- [Semantic graph](https://github.com/sahildhanawadeofficial/latch/blob/master/ai_engine/semantic_web.py): `ai_engine/semantic_web.py`

### Other components

- **User**

## Connections

- User → Application shell: uses
- Application shell → Authentication UI: renders (evidence: `frontend/src/App.jsx`)
- Application shell → Financial dashboard: renders (evidence: `frontend/src/App.jsx`)
- Application shell → Deep learning lab: renders (evidence: `frontend/src/App.jsx`)
- Application shell → IR search: renders (evidence: `frontend/src/App.jsx`)
- Application shell → AI chatbot UI: renders (evidence: `frontend/src/App.jsx`)
- Authentication UI → Face biometrics: uses (evidence: `frontend/src/components/AuthModal.jsx`)
- Financial dashboard → Face biometrics: uses (evidence: `frontend/src/pages/Dashboard.jsx`)
- Authentication routes → Authentication controller: dispatches (evidence: `backend/routes/authRoutes.js`)
- Authentication routes → Token middleware: protects (evidence: `backend/routes/authRoutes.js`)
- Authentication controller → Identity state: reads/writes (evidence: `backend/controllers/authController.js`)
- Authentication controller → JWT key service: loads keys (evidence: `backend/controllers/authController.js`)
- Authentication controller → Email service: sends email (evidence: `backend/controllers/authController.js`)
- Token middleware → JWT key service: loads keys (evidence: `backend/middleware/authMiddleware.js`)
- Transaction routes → Transaction controller: dispatches (evidence: `backend/routes/transactionRoutes.js`)
- Transaction routes → Token middleware: protects (evidence: `backend/routes/transactionRoutes.js`)
- Transaction controller → Transaction state: reads/writes (evidence: `backend/controllers/transactionController.js`)
- Transaction controller → Mongo transaction models: queries (evidence: `backend/controllers/transactionController.js`)
- Transaction controller → AI API service: requests risk (evidence: `backend/controllers/transactionController.js`)
- AI proxy routes → AI API service: forwards requests (evidence: `backend/routes/aiProxyRoutes.js`)
- AI API service → Liveness classifier: calls (evidence: `ai_engine/app.py`)
- AI API service → Anomaly detection: calls (evidence: `ai_engine/app.py`)
- AI API service → Spending clusters: calls (evidence: `ai_engine/app.py`)
- AI API service → Vision pipeline: calls (evidence: `ai_engine/app.py`)
- AI API service → Vision case studies: calls (evidence: `ai_engine/app.py`)
- AI API service → Web crawler: calls (evidence: `ai_engine/app.py`)
- AI API service → PageRank: calls (evidence: `ai_engine/app.py`)
- AI API service → MapReduce indexer: calls (evidence: `ai_engine/app.py`)
- AI API service → Parallel retrieval: calls (evidence: `ai_engine/app.py`)
- AI API service → Language-model IR: calls (evidence: `ai_engine/app.py`)
- AI API service → Ranking evaluation: calls (evidence: `ai_engine/app.py`)
- AI API service → Recommender: calls (evidence: `ai_engine/app.py`)
- AI API service → Entity extraction: calls (evidence: `ai_engine/app.py`)
- AI API service → Semantic graph: calls (evidence: `ai_engine/app.py`)
- Web crawler → MapReduce indexer: refreshes index (evidence: `ai_engine/app.py`)
- Web crawler → Language-model IR: fits corpus (evidence: `ai_engine/app.py`)
