# nhdnhut/noosguard architecture

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

- Interactive diagram: https://gitdiagram.com/nhdnhut/noosguard
- Repository: https://github.com/nhdnhut/noosguard

## Overview

NoosGuard is a transaction-fraud prevention layer designed to run alongside a merchant’s payment gateway. Its principal workflow evaluates a payment before funds move, then allows, holds for human review, or denies it with an explanation; passkey approval, layered fraud defenses, and AI-assisted decisions are major capabilities. The graph combines sampled implementation evidence with documented product capabilities. Several feature implementations were not sampled, so their links are documented rather than inferred from neighboring modules.

Main entry points: [`server/app.ts`](https://github.com/nhdnhut/noosguard/blob/main/server/app.ts) (HTTP API), [`server/index.ts`](https://github.com/nhdnhut/noosguard/blob/main/server/index.ts) (Server runtime), [`server/services/trust.ts`](https://github.com/nhdnhut/noosguard/blob/main/server/services/trust.ts) (Risk decisions), [`server/services/noosid.ts`](https://github.com/nhdnhut/noosguard/blob/main/server/services/noosid.ts) (NoosID passkeys)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Product entry points"]
  node_web["Web application<br/>[App.tsx]"]
  node_console["Business console"]
  node_api["HTTP API<br/>[app.ts]"]
end

subgraph group_decision["Payment protection"]
  node_pulse["NoosPulse checks<br/>[pulse.ts]"]
  node_device["Device signing<br/>[crypto.ts]"]
  node_shield["NoosShield<br/>[shield.js]"]
  node_noosai["NoosAI models"]
  node_decisioning["Risk decisions<br/>[trust.ts]"]
end

subgraph group_identity["Identity and review"]
  node_noosid["NoosID passkeys<br/>[noosid.ts]"]
  node_approval["Payment approval<br/>[NoosIdApp.tsx]"]
  node_cases["Cases and review<br/>[cases.ts]"]
end

subgraph group_platform["Platform operations"]
  node_storage[("Database<br/>[db.ts]")]
  node_runtime["Server runtime<br/>[index.ts]"]
  node_audit["Audit trail<br/>[audit.ts]"]
  node_lab["Sandbox Lab<br/>[runner.ts]"]
  node_webhooks["Merchant webhooks<br/>[webhooks.ts]"]
  node_woocommerce["WooCommerce connector"]
end

node_shopper(("Shopper"))
node_merchant(("Merchant team"))
node_gateway["Payment gateway"]

node_shopper -->|"uses"| node_web
node_merchant -->|"reviews"| node_console
node_web -->|"requests"| node_api
node_console -->|"loads decision"| node_api
node_runtime -->|"opens and migrates"| node_storage
node_runtime -->|"builds"| node_api
node_api -.->|"serves API data"| node_storage
node_api -.->|"checks payment"| node_pulse
node_api -.->|"verifies device"| node_device
node_api -.->|"uses browser defense"| node_shield
node_api -.->|"scores risk"| node_noosai
node_api -.->|"decides outcome"| node_decisioning
node_decisioning -.->|"requests confirmation"| node_noosid
node_shopper -->|"approves by passkey"| node_approval
node_approval -.->|"authenticates"| node_noosid
node_merchant -->|"reviews cases"| node_cases
node_lab -->|"starts sessions"| node_noosid
node_lab -->|"labels training data"| node_noosai
node_runtime -->|"dispatches deliveries"| node_webhooks
node_webhooks -.->|"sends events"| node_gateway
node_woocommerce -.->|"integrates"| node_api
node_decisioning -.->|"records outcome"| node_audit

click node_web "https://github.com/nhdnhut/noosguard/blob/main/src/App.tsx"
click node_console "https://github.com/nhdnhut/noosguard/blob/main/src/app/routes/admin/AdminSessionPage.tsx"
click node_api "https://github.com/nhdnhut/noosguard/blob/main/server/app.ts"
click node_storage "https://github.com/nhdnhut/noosguard/blob/main/server/db.ts"
click node_runtime "https://github.com/nhdnhut/noosguard/blob/main/server/index.ts"
click node_pulse "https://github.com/nhdnhut/noosguard/blob/main/server/services/pulse.ts"
click node_device "https://github.com/nhdnhut/noosguard/blob/main/server/lib/crypto.ts"
click node_shield "https://github.com/nhdnhut/noosguard/blob/main/server/sdk/shield.js"
click node_noosai "https://github.com/nhdnhut/noosguard/tree/main/server/services/ml"
click node_decisioning "https://github.com/nhdnhut/noosguard/blob/main/server/services/trust.ts"
click node_noosid "https://github.com/nhdnhut/noosguard/blob/main/server/services/noosid.ts"
click node_approval "https://github.com/nhdnhut/noosguard/blob/main/src/app/routes/noosid/NoosIdApp.tsx"
click node_cases "https://github.com/nhdnhut/noosguard/blob/main/server/services/cases.ts"
click node_audit "https://github.com/nhdnhut/noosguard/blob/main/server/services/audit.ts"
click node_lab "https://github.com/nhdnhut/noosguard/blob/main/server/services/lab/runner.ts"
click node_webhooks "https://github.com/nhdnhut/noosguard/blob/main/server/services/webhooks.ts"
click node_woocommerce "https://github.com/nhdnhut/noosguard/blob/main/integrations/woocommerce/noosguard-woocommerce/includes/class-noosguard-client.php"

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_web,node_console,node_api toneBlue
class node_pulse,node_device,node_shield,node_noosai,node_decisioning toneAmber
class node_noosid,node_approval,node_cases toneMint
class node_storage,node_runtime,node_audit,node_lab,node_webhooks,node_woocommerce toneRose
class node_shopper,node_merchant,node_gateway toneIndigo
```

## Components

### Product entry points

- [Web application](https://github.com/nhdnhut/noosguard/blob/main/src/App.tsx): `src/App.tsx`
- [Business console](https://github.com/nhdnhut/noosguard/blob/main/src/app/routes/admin/AdminSessionPage.tsx): `src/app/routes/admin/AdminSessionPage.tsx`
- [HTTP API](https://github.com/nhdnhut/noosguard/blob/main/server/app.ts): `server/app.ts`

### Payment protection

- [NoosPulse checks](https://github.com/nhdnhut/noosguard/blob/main/server/services/pulse.ts): `server/services/pulse.ts`
- [Device signing](https://github.com/nhdnhut/noosguard/blob/main/server/lib/crypto.ts): `server/lib/crypto.ts`
- [NoosShield](https://github.com/nhdnhut/noosguard/blob/main/server/sdk/shield.js): `server/sdk/shield.js`
- [NoosAI models](https://github.com/nhdnhut/noosguard/tree/main/server/services/ml): `server/services/ml`
- [Risk decisions](https://github.com/nhdnhut/noosguard/blob/main/server/services/trust.ts): `server/services/trust.ts`

### Identity and review

- [NoosID passkeys](https://github.com/nhdnhut/noosguard/blob/main/server/services/noosid.ts): `server/services/noosid.ts`
- [Payment approval](https://github.com/nhdnhut/noosguard/blob/main/src/app/routes/noosid/NoosIdApp.tsx): `src/app/routes/noosid/NoosIdApp.tsx`
- [Cases and review](https://github.com/nhdnhut/noosguard/blob/main/server/services/cases.ts): `server/services/cases.ts`

### Platform operations

- [Database](https://github.com/nhdnhut/noosguard/blob/main/server/db.ts): `server/db.ts`
- [Server runtime](https://github.com/nhdnhut/noosguard/blob/main/server/index.ts): `server/index.ts`
- [Audit trail](https://github.com/nhdnhut/noosguard/blob/main/server/services/audit.ts): `server/services/audit.ts`
- [Sandbox Lab](https://github.com/nhdnhut/noosguard/blob/main/server/services/lab/runner.ts): `server/services/lab/runner.ts`
- [Merchant webhooks](https://github.com/nhdnhut/noosguard/blob/main/server/services/webhooks.ts): `server/services/webhooks.ts`
- [WooCommerce connector](https://github.com/nhdnhut/noosguard/blob/main/integrations/woocommerce/noosguard-woocommerce/includes/class-noosguard-client.php): `integrations/woocommerce/noosguard-woocommerce/includes/class-noosguard-client.php`

### Other components

- **Shopper**
- **Merchant team**
- **Payment gateway**

## Connections

- Shopper → Web application: uses
- Merchant team → Business console: reviews
- Web application → HTTP API: requests
- Business console → HTTP API: loads decision (evidence: `src/app/routes/admin/AdminSessionPage.tsx`)
- Server runtime → Database: opens and migrates (evidence: `server/index.ts`)
- Server runtime → HTTP API: builds (evidence: `server/index.ts`)
- HTTP API → Database: serves API data (evidence: `server/app.ts`)
- HTTP API → NoosPulse checks: checks payment
- HTTP API → Device signing: verifies device
- HTTP API → NoosShield: uses browser defense
- HTTP API → NoosAI models: scores risk
- HTTP API → Risk decisions: decides outcome (evidence: `server/app.ts`)
- Risk decisions → NoosID passkeys: requests confirmation
- Shopper → Payment approval: approves by passkey
- Payment approval → NoosID passkeys: authenticates
- Merchant team → Cases and review: reviews cases
- Sandbox Lab → NoosID passkeys: starts sessions (evidence: `server/services/lab/runner.ts`)
- Sandbox Lab → NoosAI models: labels training data (evidence: `server/services/lab/runner.ts`)
- Server runtime → Merchant webhooks: dispatches deliveries (evidence: `server/index.ts`)
- Merchant webhooks → Payment gateway: sends events
- WooCommerce connector → HTTP API: integrates
- Risk decisions → Audit trail: records outcome
