# imayankss/secureswipe architecture

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

- Interactive diagram: https://gitdiagram.com/imayankss/secureswipe
- Repository: https://github.com/imayankss/secureswipe

## Overview

SecureSwipe is a defense-only fraud-risk manager: it ranks suspicious transactions against a human-review capacity and returns bounded review outcomes, never payment authorization or decline decisions. Its reference API supports verified-bundle scoring, provenance, audit and idempotent replay; the browser also presents product, evidence and demo surfaces. Offline data preparation, model evaluation and monitoring preserve the scientific evidence behind the capacity trade-off. The README documents the workflow and evidence boundaries; several subsystem paths below come from the tree and index, so their internal calls are not inferred.

Main entry points: [`api/main.py`](https://github.com/imayankss/secureswipe/blob/main/api/main.py) (Reference API), [`api/service.py`](https://github.com/imayankss/secureswipe/blob/main/api/service.py) (Model service), [`src/artifacts/bundle.py`](https://github.com/imayankss/secureswipe/blob/main/src/artifacts/bundle.py) (Verified bundles), [`src/inference/batch_scoring.py`](https://github.com/imayankss/secureswipe/blob/main/src/inference/batch_scoring.py) (Batch scoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reviewer["Reviewer surfaces"]
  node_home["Product surface<br/>[page.tsx]"]
  node_evidence_ui["Evidence surface<br/>[page.tsx]"]
  node_demo_ui["Bounded demo"]
end

subgraph group_serving["Bounded serving"]
  node_api["Reference API<br/>[main.py]"]
  node_schemas["Request schemas<br/>[schemas.py]"]
  node_service["Model service<br/>[service.py]"]
  node_audit["Audit receipts<br/>[audit.py]"]
  node_idempotency[("Replay store")]
end

subgraph group_evidence["Offline evidence"]
  node_quarantine["Historical quarantine"]
  node_reference["Reference data"]
  node_capacity["Capacity evaluation"]
  node_offline_monitor["Offline monitoring<br/>[offline.py]"]
  node_explainability["Model explainability<br/>[shap_explainer.py]"]
end

subgraph group_model["Model internals"]
  node_bundle["Verified bundles<br/>[bundle.py]"]
  node_scoring["Batch scoring<br/>[batch_scoring.py]"]
  node_preprocessing["Feature preprocessing<br/>[preprocessors.py]"]
end

node_analyst(("Risk analyst"))

node_analyst -->|"reviews"| node_home
node_analyst -->|"inspects evidence"| node_evidence_ui
node_analyst -->|"runs walkthrough"| node_demo_ui
node_api -->|"dispatches inference"| node_service
node_api -->|"validates requests"| node_schemas
node_api -.->|"records decisions"| node_audit
node_api -->|"replays requests"| node_idempotency
node_service -->|"verifies bundle"| node_bundle
node_service -->|"scores transactions"| node_scoring
node_scoring -->|"transforms features"| node_preprocessing
node_service -->|"returns predictions"| node_schemas
node_bundle -->|"records feature contract"| node_preprocessing
node_analyst -->|"reviews capacity results"| node_capacity
node_analyst -.->|"inspects explanations"| node_explainability
node_analyst -.->|"reviews monitoring"| node_offline_monitor
node_analyst -.->|"reviews reference evidence"| node_reference
node_analyst -.->|"reviews quarantine evidence"| node_quarantine

click node_home "https://github.com/imayankss/secureswipe/blob/main/web/app/page.tsx"
click node_evidence_ui "https://github.com/imayankss/secureswipe/blob/main/web/app/evidence/page.tsx"
click node_demo_ui "https://github.com/imayankss/secureswipe/blob/main/web/components/product/BoundedReviewWorkflow.tsx"
click node_api "https://github.com/imayankss/secureswipe/blob/main/api/main.py"
click node_schemas "https://github.com/imayankss/secureswipe/blob/main/api/schemas.py"
click node_service "https://github.com/imayankss/secureswipe/blob/main/api/service.py"
click node_audit "https://github.com/imayankss/secureswipe/blob/main/api/audit.py"
click node_idempotency "https://github.com/imayankss/secureswipe/blob/main/api/postgres_idempotency.py"
click node_bundle "https://github.com/imayankss/secureswipe/blob/main/src/artifacts/bundle.py"
click node_scoring "https://github.com/imayankss/secureswipe/blob/main/src/inference/batch_scoring.py"
click node_preprocessing "https://github.com/imayankss/secureswipe/blob/main/src/preprocessing/preprocessors.py"
click node_quarantine "https://github.com/imayankss/secureswipe/blob/main/src/data/historical_quarantine.py"
click node_reference "https://github.com/imayankss/secureswipe/blob/main/src/data/historical_reference.py"
click node_capacity "https://github.com/imayankss/secureswipe/tree/main/src/lane_a"
click node_offline_monitor "https://github.com/imayankss/secureswipe/blob/main/src/monitoring/offline.py"
click node_explainability "https://github.com/imayankss/secureswipe/blob/main/src/explainability/shap_explainer.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_home,node_evidence_ui,node_demo_ui toneBlue
class node_api,node_schemas,node_service,node_audit,node_idempotency toneAmber
class node_quarantine,node_reference,node_capacity,node_offline_monitor,node_explainability toneMint
class node_bundle,node_scoring,node_preprocessing toneRose
class node_analyst toneIndigo
```

## Components

### Reviewer surfaces

- [Product surface](https://github.com/imayankss/secureswipe/blob/main/web/app/page.tsx): `web/app/page.tsx`
- [Evidence surface](https://github.com/imayankss/secureswipe/blob/main/web/app/evidence/page.tsx): `web/app/evidence/page.tsx`
- [Bounded demo](https://github.com/imayankss/secureswipe/blob/main/web/components/product/BoundedReviewWorkflow.tsx): `web/components/product/BoundedReviewWorkflow.tsx`

### Bounded serving

- [Reference API](https://github.com/imayankss/secureswipe/blob/main/api/main.py): `api/main.py`
- [Request schemas](https://github.com/imayankss/secureswipe/blob/main/api/schemas.py): `api/schemas.py`
- [Model service](https://github.com/imayankss/secureswipe/blob/main/api/service.py): `api/service.py`
- [Audit receipts](https://github.com/imayankss/secureswipe/blob/main/api/audit.py): `api/audit.py`
- [Replay store](https://github.com/imayankss/secureswipe/blob/main/api/postgres_idempotency.py): `api/postgres_idempotency.py`

### Offline evidence

- [Historical quarantine](https://github.com/imayankss/secureswipe/blob/main/src/data/historical_quarantine.py): `src/data/historical_quarantine.py`
- [Reference data](https://github.com/imayankss/secureswipe/blob/main/src/data/historical_reference.py): `src/data/historical_reference.py`
- [Capacity evaluation](https://github.com/imayankss/secureswipe/tree/main/src/lane_a): `src/lane_a`
- [Offline monitoring](https://github.com/imayankss/secureswipe/blob/main/src/monitoring/offline.py): `src/monitoring/offline.py`
- [Model explainability](https://github.com/imayankss/secureswipe/blob/main/src/explainability/shap_explainer.py): `src/explainability/shap_explainer.py`

### Model internals

- [Verified bundles](https://github.com/imayankss/secureswipe/blob/main/src/artifacts/bundle.py): `src/artifacts/bundle.py`
- [Batch scoring](https://github.com/imayankss/secureswipe/blob/main/src/inference/batch_scoring.py): `src/inference/batch_scoring.py`
- [Feature preprocessing](https://github.com/imayankss/secureswipe/blob/main/src/preprocessing/preprocessors.py): `src/preprocessing/preprocessors.py`

### Other components

- **Risk analyst**

## Connections

- Risk analyst → Product surface: reviews (evidence: `README.md`)
- Risk analyst → Evidence surface: inspects evidence (evidence: `README.md`)
- Risk analyst → Bounded demo: runs walkthrough (evidence: `README.md`)
- Reference API → Model service: dispatches inference (evidence: `api/main.py`)
- Reference API → Request schemas: validates requests (evidence: `api/main.py`)
- Reference API → Audit receipts: records decisions (evidence: `api/main.py`)
- Reference API → Replay store: replays requests (evidence: `api/main.py`)
- Model service → Verified bundles: verifies bundle (evidence: `api/service.py`)
- Model service → Batch scoring: scores transactions (evidence: `api/service.py`)
- Batch scoring → Feature preprocessing: transforms features (evidence: `src/inference/batch_scoring.py`)
- Model service → Request schemas: returns predictions (evidence: `api/service.py`)
- Verified bundles → Feature preprocessing: records feature contract (evidence: `src/artifacts/bundle.py`)
- Risk analyst → Capacity evaluation: reviews capacity results (evidence: `README.md`)
- Risk analyst → Model explainability: inspects explanations
- Risk analyst → Offline monitoring: reviews monitoring
- Risk analyst → Reference data: reviews reference evidence
- Risk analyst → Historical quarantine: reviews quarantine evidence
