# ahmadnassri/node-har-validator architecture

> Architecture diagram of the GitHub repository ahmadnassri/node-har-validator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahmadnassri/node-har-validator
- Repository: https://github.com/ahmadnassri/node-har-validator

## Overview

HAR Validator is a small Node.js library for checking HAR objects and individual HAR parts against JSON Schema. A caller uses the Promise API by default or the callback-compatible API; both configure Ajv with har-schema schemas, validate the requested schema, and report validation failures through HARError. The source excerpts show these runtime relationships; the CLI is a separate project, and no CLI implementation is present here.

Main entry points: [`lib/promise.js`](https://github.com/ahmadnassri/node-har-validator/blob/master/lib/promise.js) (Promise API), [`lib/async.js`](https://github.com/ahmadnassri/node-har-validator/blob/master/lib/async.js) (Callback API), [`lib/error.js`](https://github.com/ahmadnassri/node-har-validator/blob/master/lib/error.js) (HARError)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Library caller"))
node_promise["Promise API<br/>[promise.js]"]
node_callback["Callback API<br/>[async.js]"]
node_ajv["Ajv validator"]
node_schemas["HAR schemas"]
node_error["HARError<br/>[error.js]"]

node_caller -->|"uses by default"| node_promise
node_caller -->|"uses callback API"| node_callback
node_promise -->|"configures and validates"| node_ajv
node_promise -->|"registers schemas"| node_schemas
node_promise -->|"creates on failure"| node_error
node_callback -->|"configures and validates"| node_ajv
node_callback -->|"registers schemas"| node_schemas
node_callback -->|"creates on failure"| node_error

click node_promise "https://github.com/ahmadnassri/node-har-validator/blob/master/lib/promise.js"
click node_callback "https://github.com/ahmadnassri/node-har-validator/blob/master/lib/async.js"
click node_error "https://github.com/ahmadnassri/node-har-validator/blob/master/lib/error.js"

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_caller,node_ajv,node_schemas toneIndigo
class node_promise,node_callback toneMint
class node_error toneTeal
```

## Components

### Other components

- **Library caller**
- [Promise API](https://github.com/ahmadnassri/node-har-validator/blob/master/lib/promise.js): `lib/promise.js`
- [Callback API](https://github.com/ahmadnassri/node-har-validator/blob/master/lib/async.js): `lib/async.js`
- **Ajv validator**
- **HAR schemas**
- [HARError](https://github.com/ahmadnassri/node-har-validator/blob/master/lib/error.js): `lib/error.js`

## Connections

- Library caller → Promise API: uses by default
- Library caller → Callback API: uses callback API (evidence: `README.md`)
- Promise API → Ajv validator: configures and validates (evidence: `lib/promise.js`)
- Promise API → HAR schemas: registers schemas (evidence: `lib/promise.js`)
- Promise API → HARError: creates on failure (evidence: `lib/promise.js`)
- Callback API → Ajv validator: configures and validates (evidence: `lib/async.js`)
- Callback API → HAR schemas: registers schemas (evidence: `lib/async.js`)
- Callback API → HARError: creates on failure (evidence: `lib/async.js`)
