# davoa07/antiforge architecture

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

- Interactive diagram: https://gitdiagram.com/davoa07/antiforge
- Repository: https://github.com/davoa07/antiforge

## Overview

AntiForge is a browser-only online signature verification app. Users capture several reference signatures, enroll them as an identity, then capture a query signature and receive a genuine/forged score with explanatory factors and replay. The engine preprocesses trajectories, builds a writer-specific template from reference distances, and scores queries using calibrated DTW matchers. Identities persist locally and can be exported or imported. The README also documents SVC2004 benchmarking and landing-page ROC results; benchmark internals are represented only at directory level because their source was not sampled. Edges reflect shown calls or README descriptions.

Main entry points: [`src/lib/engine/verify.ts`](https://github.com/davoa07/antiforge/blob/main/src/lib/engine/verify.ts) (Verification decision), [`src/app/page.tsx`](https://github.com/davoa07/antiforge/blob/main/src/app/page.tsx) (Landing page), [`src/app/verify/page.tsx`](https://github.com/davoa07/antiforge/blob/main/src/app/verify/page.tsx) (Verify page), [`src/app/enroll/page.tsx`](https://github.com/davoa07/antiforge/blob/main/src/app/enroll/page.tsx) (Enroll page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_home["Landing page<br/>[page.tsx]"]
  node_enroll["Enroll page<br/>[page.tsx]"]
  node_verify_page["Verify page<br/>[page.tsx]"]
  node_identities_page["Identity manager<br/>[page.tsx]"]
  node_signature_pad["Signature capture<br/>[signature-pad.tsx]"]
  node_replay["Signature replay"]
  node_verdict["Verdict display<br/>[verdict-card.tsx]"]
end

subgraph group_engine["Verification engine"]
  node_preprocess["Trajectory preprocessing<br/>[preprocess.ts]"]
  node_dtw["DTW matching<br/>[dtw.ts]"]
  node_template["Writer template<br/>[template.ts]"]
  node_decision["Verification decision<br/>[verify.ts]"]
  node_calibration["Model calibration<br/>[calibration.ts]"]
end

subgraph group_identity["Local identities"]
  node_identity_store[("Identity persistence<br/>[store.ts]")]
end

subgraph group_benchmark["Benchmark insights"]
  node_benchmark_data["SVC2004 evaluation"]
  node_roc_chart["ROC results chart<br/>[roc-chart.tsx]"]
  node_bench_data_ui["Benchmark summary<br/>[bench.ts]"]
end

node_visitor(("User"))
node_browser_db[("IndexedDB")]

node_home -->|"links to"| node_enroll
node_home -->|"renders"| node_roc_chart
node_home -->|"reads results"| node_bench_data_ui
node_home -->|"renders demo"| node_signature_pad
node_enroll -->|"captures references"| node_signature_pad
node_enroll -->|"builds template"| node_template
node_enroll -->|"saves identity"| node_identity_store
node_verify_page -->|"captures query"| node_signature_pad
node_verify_page -->|"loads identity"| node_identity_store
node_verify_page -->|"verifies signature"| node_decision
node_verify_page -->|"renders result"| node_verdict
node_verdict -->|"renders replay"| node_replay
node_identities_page -->|"manages identities"| node_identity_store
node_identity_store -->|"reads and writes"| node_browser_db
node_signature_pad -->|"provides strokes"| node_preprocess
node_template -->|"preprocesses references"| node_preprocess
node_template -->|"measures spread"| node_dtw
node_decision -->|"preprocesses query"| node_preprocess
node_decision -->|"uses reference template"| node_template
node_decision -->|"compares sequences"| node_dtw
node_preprocess -->|"uses feature scales"| node_calibration
node_dtw -->|"uses DTW settings"| node_calibration
node_decision -->|"applies decision model"| node_calibration
node_benchmark_data -.->|"fits shipped model"| node_calibration
node_roc_chart -->|"renders metrics"| node_bench_data_ui

click node_home "https://github.com/davoa07/antiforge/blob/main/src/app/page.tsx"
click node_enroll "https://github.com/davoa07/antiforge/blob/main/src/app/enroll/page.tsx"
click node_verify_page "https://github.com/davoa07/antiforge/blob/main/src/app/verify/page.tsx"
click node_identities_page "https://github.com/davoa07/antiforge/blob/main/src/app/identities/page.tsx"
click node_signature_pad "https://github.com/davoa07/antiforge/blob/main/src/components/signature-pad.tsx"
click node_replay "https://github.com/davoa07/antiforge/blob/main/src/components/signature-replay.tsx"
click node_verdict "https://github.com/davoa07/antiforge/blob/main/src/components/verdict-card.tsx"
click node_preprocess "https://github.com/davoa07/antiforge/blob/main/src/lib/engine/preprocess.ts"
click node_dtw "https://github.com/davoa07/antiforge/blob/main/src/lib/engine/dtw.ts"
click node_template "https://github.com/davoa07/antiforge/blob/main/src/lib/engine/template.ts"
click node_decision "https://github.com/davoa07/antiforge/blob/main/src/lib/engine/verify.ts"
click node_calibration "https://github.com/davoa07/antiforge/blob/main/src/lib/engine/calibration.ts"
click node_identity_store "https://github.com/davoa07/antiforge/blob/main/src/lib/store.ts"
click node_benchmark_data "https://github.com/davoa07/antiforge/tree/main/bench"
click node_roc_chart "https://github.com/davoa07/antiforge/blob/main/src/components/roc-chart.tsx"
click node_bench_data_ui "https://github.com/davoa07/antiforge/blob/main/src/lib/bench.ts"

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_enroll,node_verify_page,node_identities_page,node_signature_pad,node_replay,node_verdict,node_visitor toneBlue
class node_preprocess,node_dtw,node_template,node_decision,node_calibration,node_browser_db toneAmber
class node_identity_store toneMint
class node_benchmark_data,node_roc_chart,node_bench_data_ui toneRose
```

## Components

### App experience

- [Landing page](https://github.com/davoa07/antiforge/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Enroll page](https://github.com/davoa07/antiforge/blob/main/src/app/enroll/page.tsx): `src/app/enroll/page.tsx`
- [Verify page](https://github.com/davoa07/antiforge/blob/main/src/app/verify/page.tsx): `src/app/verify/page.tsx`
- [Identity manager](https://github.com/davoa07/antiforge/blob/main/src/app/identities/page.tsx): `src/app/identities/page.tsx`
- [Signature capture](https://github.com/davoa07/antiforge/blob/main/src/components/signature-pad.tsx): `src/components/signature-pad.tsx`
- [Signature replay](https://github.com/davoa07/antiforge/blob/main/src/components/signature-replay.tsx): `src/components/signature-replay.tsx`
- [Verdict display](https://github.com/davoa07/antiforge/blob/main/src/components/verdict-card.tsx): `src/components/verdict-card.tsx`

### Verification engine

- [Trajectory preprocessing](https://github.com/davoa07/antiforge/blob/main/src/lib/engine/preprocess.ts): `src/lib/engine/preprocess.ts`
- [DTW matching](https://github.com/davoa07/antiforge/blob/main/src/lib/engine/dtw.ts): `src/lib/engine/dtw.ts`
- [Writer template](https://github.com/davoa07/antiforge/blob/main/src/lib/engine/template.ts): `src/lib/engine/template.ts`
- [Verification decision](https://github.com/davoa07/antiforge/blob/main/src/lib/engine/verify.ts): `src/lib/engine/verify.ts`
- [Model calibration](https://github.com/davoa07/antiforge/blob/main/src/lib/engine/calibration.ts): `src/lib/engine/calibration.ts`

### Local identities

- [Identity persistence](https://github.com/davoa07/antiforge/blob/main/src/lib/store.ts): `src/lib/store.ts`

### Benchmark insights

- [SVC2004 evaluation](https://github.com/davoa07/antiforge/tree/main/bench): `bench`
- [ROC results chart](https://github.com/davoa07/antiforge/blob/main/src/components/roc-chart.tsx): `src/components/roc-chart.tsx`
- [Benchmark summary](https://github.com/davoa07/antiforge/blob/main/src/lib/bench.ts): `src/lib/bench.ts`

### Other components

- **User**
- **IndexedDB**

## Connections

- Landing page → Enroll page: links to (evidence: `src/app/page.tsx`)
- Landing page → ROC results chart: renders (evidence: `src/app/page.tsx`)
- Landing page → Benchmark summary: reads results (evidence: `src/app/page.tsx`)
- Landing page → Signature capture: renders demo (evidence: `src/app/page.tsx`)
- Enroll page → Signature capture: captures references (evidence: `src/app/enroll/page.tsx`)
- Enroll page → Writer template: builds template (evidence: `README.md`)
- Enroll page → Identity persistence: saves identity (evidence: `src/app/enroll/page.tsx`)
- Verify page → Signature capture: captures query (evidence: `src/app/verify/page.tsx`)
- Verify page → Identity persistence: loads identity (evidence: `src/app/verify/page.tsx`)
- Verify page → Verification decision: verifies signature (evidence: `README.md`)
- Verify page → Verdict display: renders result (evidence: `src/app/verify/page.tsx`)
- Verdict display → Signature replay: renders replay (evidence: `src/components/verdict-card.tsx`)
- Identity manager → Identity persistence: manages identities (evidence: `src/app/identities/page.tsx`)
- Identity persistence → IndexedDB: reads and writes (evidence: `src/lib/store.ts`)
- Signature capture → Trajectory preprocessing: provides strokes (evidence: `README.md`)
- Writer template → Trajectory preprocessing: preprocesses references (evidence: `src/lib/engine/template.ts`)
- Writer template → DTW matching: measures spread (evidence: `src/lib/engine/template.ts`)
- Verification decision → Trajectory preprocessing: preprocesses query (evidence: `src/lib/engine/verify.ts`)
- Verification decision → Writer template: uses reference template (evidence: `src/lib/engine/verify.ts`)
- Verification decision → DTW matching: compares sequences (evidence: `src/lib/engine/verify.ts`)
- Trajectory preprocessing → Model calibration: uses feature scales (evidence: `src/lib/engine/preprocess.ts`)
- DTW matching → Model calibration: uses DTW settings (evidence: `src/lib/engine/dtw.ts`)
- Verification decision → Model calibration: applies decision model (evidence: `src/lib/engine/verify.ts`)
- SVC2004 evaluation → Model calibration: fits shipped model (evidence: `README.md`)
- ROC results chart → Benchmark summary: renders metrics (evidence: `src/components/roc-chart.tsx`)
