# dareid/chakram architecture

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

- Interactive diagram: https://gitdiagram.com/dareid/chakram
- Repository: https://github.com/dareid/chakram

## Overview

Chakram is a promise-based BDD library for end-to-end testing of JSON REST APIs. A test author issues HTTP requests, passes their promises to expectations, and waits for the resulting assertions; request methods produce response objects that carry the body, headers, cookies, URL, and timing data used by matchers. The map includes the documented HTTP assertion families and plugin/debug capabilities. Several assertion implementations were not excerpted, so their individual internals and connections are not inferred.

Main entry points: [`lib/assertions/index.js`](https://github.com/dareid/chakram/blob/master/lib/assertions/index.js) (Matcher registry), [`lib/chakram.js`](https://github.com/dareid/chakram/blob/master/lib/chakram.js) (Chakram API), [`lib/methods.js`](https://github.com/dareid/chakram/blob/master/lib/methods.js) (Request execution), [`lib/plugins.js`](https://github.com/dareid/chakram/blob/master/lib/plugins.js) (Plugin registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Public API"]
  node_api["Chakram API<br/>[chakram.js]"]
  node_expect["Promise expectations<br/>[chakram.js]"]
  node_promise["Promise coordination<br/>[chakram.js]"]
end

subgraph group_http["HTTP Requests"]
  node_methods["HTTP verb methods<br/>[methods.js]"]
  node_request["Request execution<br/>[methods.js]"]
  node_response["Response object<br/>[methods.js]"]
end

subgraph group_assertions["Response Assertions"]
  node_status["Status assertion<br/>[statuscode.js]"]
  node_header["Header assertion<br/>[header.js]"]
  node_cookie["Cookie assertion<br/>[cookie.js]"]
  node_json["JSON assertion<br/>[json.js]"]
  node_schema["Schema assertion<br/>[schema.js]"]
  node_compression["Compression assertion<br/>[compression.js]"]
  node_comprise["JSON comprise<br/>[comprise.js]"]
  node_responsetime["Response-time assertion<br/>[responsetime.js]"]
  node_arraylength["Array length assertion<br/>[arrayLength.js]"]
  node_arrayincluding["Array inclusion assertion<br/>[arrayIncluding.js]"]
  node_objectpath["JSON path lookup<br/>[objectPath.js]"]
  node_matcherindex["Matcher registry<br/>[index.js]"]
end

subgraph group_extensions["Plugins and Debug"]
  node_plugin["Plugin registration<br/>[plugins.js]"]
  node_debug["Request debugging<br/>[debug.js]"]
end

node_author(("Test author"))
node_httpservice(("REST API"))

node_author -->|"uses"| node_api
node_api -->|"exports methods"| node_methods
node_api -->|"exports plugins"| node_plugin
node_api -->|"exports debugging"| node_debug
node_author -->|"issues requests"| node_methods
node_methods -->|"dispatches verbs"| node_request
node_request -->|"sends HTTP"| node_httpservice
node_request -->|"resolves response"| node_response
node_author -->|"asserts response"| node_expect
node_expect -->|"initializes Chai"| node_plugin
node_expect -->|"records promises"| node_promise
node_promise -->|"provides wait"| node_author
node_plugin -->|"registers matchers"| node_matcherindex
node_matcherindex -->|"loads matcher"| node_status
node_matcherindex -->|"loads matcher"| node_header
node_matcherindex -->|"loads matcher"| node_cookie
node_matcherindex -->|"loads matcher"| node_schema
node_matcherindex -->|"loads matcher"| node_json
node_matcherindex -->|"loads matcher"| node_compression
node_matcherindex -->|"loads matcher"| node_comprise
node_matcherindex -->|"loads matcher"| node_responsetime
node_matcherindex -->|"loads matcher"| node_arraylength
node_matcherindex -->|"loads matcher"| node_arrayincluding
node_arrayincluding -->|"looks up path"| node_objectpath
node_arraylength -->|"looks up path"| node_objectpath
node_json -->|"looks up path"| node_objectpath
node_debug -->|"traces traffic"| node_httpservice

click node_api "https://github.com/dareid/chakram/blob/master/lib/chakram.js"
click node_expect "https://github.com/dareid/chakram/blob/master/lib/chakram.js"
click node_promise "https://github.com/dareid/chakram/blob/master/lib/chakram.js"
click node_methods "https://github.com/dareid/chakram/blob/master/lib/methods.js"
click node_request "https://github.com/dareid/chakram/blob/master/lib/methods.js"
click node_response "https://github.com/dareid/chakram/blob/master/lib/methods.js"
click node_status "https://github.com/dareid/chakram/blob/master/lib/assertions/statuscode.js"
click node_header "https://github.com/dareid/chakram/blob/master/lib/assertions/header.js"
click node_cookie "https://github.com/dareid/chakram/blob/master/lib/assertions/cookie.js"
click node_json "https://github.com/dareid/chakram/blob/master/lib/assertions/json.js"
click node_schema "https://github.com/dareid/chakram/blob/master/lib/assertions/schema.js"
click node_compression "https://github.com/dareid/chakram/blob/master/lib/assertions/compression.js"
click node_comprise "https://github.com/dareid/chakram/blob/master/lib/assertions/comprise.js"
click node_responsetime "https://github.com/dareid/chakram/blob/master/lib/assertions/responsetime.js"
click node_arraylength "https://github.com/dareid/chakram/blob/master/lib/assertions/arrayLength.js"
click node_arrayincluding "https://github.com/dareid/chakram/blob/master/lib/assertions/arrayIncluding.js"
click node_objectpath "https://github.com/dareid/chakram/blob/master/lib/utils/objectPath.js"
click node_plugin "https://github.com/dareid/chakram/blob/master/lib/plugins.js"
click node_matcherindex "https://github.com/dareid/chakram/blob/master/lib/assertions/index.js"
click node_debug "https://github.com/dareid/chakram/blob/master/lib/debug.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_api,node_expect,node_promise toneBlue
class node_methods,node_request,node_response toneAmber
class node_status,node_header,node_cookie,node_json,node_schema,node_compression,node_comprise,node_responsetime,node_arraylength,node_arrayincluding,node_objectpath,node_matcherindex,node_httpservice toneMint
class node_plugin,node_debug toneRose
class node_author toneIndigo
```

## Components

### Public API

- [Chakram API](https://github.com/dareid/chakram/blob/master/lib/chakram.js): `lib/chakram.js`
- [Promise expectations](https://github.com/dareid/chakram/blob/master/lib/chakram.js): `lib/chakram.js`
- [Promise coordination](https://github.com/dareid/chakram/blob/master/lib/chakram.js): `lib/chakram.js`

### HTTP Requests

- [HTTP verb methods](https://github.com/dareid/chakram/blob/master/lib/methods.js): `lib/methods.js`
- [Request execution](https://github.com/dareid/chakram/blob/master/lib/methods.js): `lib/methods.js`
- [Response object](https://github.com/dareid/chakram/blob/master/lib/methods.js): `lib/methods.js`

### Response Assertions

- [Status assertion](https://github.com/dareid/chakram/blob/master/lib/assertions/statuscode.js): `lib/assertions/statuscode.js`
- [Header assertion](https://github.com/dareid/chakram/blob/master/lib/assertions/header.js): `lib/assertions/header.js`
- [Cookie assertion](https://github.com/dareid/chakram/blob/master/lib/assertions/cookie.js): `lib/assertions/cookie.js`
- [JSON assertion](https://github.com/dareid/chakram/blob/master/lib/assertions/json.js): `lib/assertions/json.js`
- [Schema assertion](https://github.com/dareid/chakram/blob/master/lib/assertions/schema.js): `lib/assertions/schema.js`
- [Compression assertion](https://github.com/dareid/chakram/blob/master/lib/assertions/compression.js): `lib/assertions/compression.js`
- [JSON comprise](https://github.com/dareid/chakram/blob/master/lib/assertions/comprise.js): `lib/assertions/comprise.js`
- [Response-time assertion](https://github.com/dareid/chakram/blob/master/lib/assertions/responsetime.js): `lib/assertions/responsetime.js`
- [Array length assertion](https://github.com/dareid/chakram/blob/master/lib/assertions/arrayLength.js): `lib/assertions/arrayLength.js`
- [Array inclusion assertion](https://github.com/dareid/chakram/blob/master/lib/assertions/arrayIncluding.js): `lib/assertions/arrayIncluding.js`
- [JSON path lookup](https://github.com/dareid/chakram/blob/master/lib/utils/objectPath.js): `lib/utils/objectPath.js`
- [Matcher registry](https://github.com/dareid/chakram/blob/master/lib/assertions/index.js): `lib/assertions/index.js`

### Plugins and Debug

- [Plugin registration](https://github.com/dareid/chakram/blob/master/lib/plugins.js): `lib/plugins.js`
- [Request debugging](https://github.com/dareid/chakram/blob/master/lib/debug.js): `lib/debug.js`

### Other components

- **Test author**
- **REST API**

## Connections

- Test author → Chakram API: uses (evidence: `README.md`)
- Chakram API → HTTP verb methods: exports methods (evidence: `lib/chakram.js`)
- Chakram API → Plugin registration: exports plugins (evidence: `lib/chakram.js`)
- Chakram API → Request debugging: exports debugging (evidence: `lib/chakram.js`)
- Test author → HTTP verb methods: issues requests (evidence: `README.md`)
- HTTP verb methods → Request execution: dispatches verbs (evidence: `lib/methods.js`)
- Request execution → REST API: sends HTTP (evidence: `lib/methods.js`)
- Request execution → Response object: resolves response (evidence: `lib/methods.js`)
- Test author → Promise expectations: asserts response (evidence: `README.md`)
- Promise expectations → Plugin registration: initializes Chai (evidence: `lib/chakram.js`)
- Promise expectations → Promise coordination: records promises (evidence: `lib/chakram.js`)
- Promise coordination → Test author: provides wait (evidence: `README.md`)
- Plugin registration → Matcher registry: registers matchers (evidence: `lib/plugins.js`)
- Matcher registry → Status assertion: loads matcher (evidence: `lib/assertions/index.js`)
- Matcher registry → Header assertion: loads matcher (evidence: `lib/assertions/index.js`)
- Matcher registry → Cookie assertion: loads matcher (evidence: `lib/assertions/index.js`)
- Matcher registry → Schema assertion: loads matcher (evidence: `lib/assertions/index.js`)
- Matcher registry → JSON assertion: loads matcher (evidence: `lib/assertions/index.js`)
- Matcher registry → Compression assertion: loads matcher (evidence: `lib/assertions/index.js`)
- Matcher registry → JSON comprise: loads matcher (evidence: `lib/assertions/index.js`)
- Matcher registry → Response-time assertion: loads matcher (evidence: `lib/assertions/index.js`)
- Matcher registry → Array length assertion: loads matcher (evidence: `lib/assertions/index.js`)
- Matcher registry → Array inclusion assertion: loads matcher (evidence: `lib/assertions/index.js`)
- Array inclusion assertion → JSON path lookup: looks up path (evidence: `lib/assertions/arrayIncluding.js`)
- Array length assertion → JSON path lookup: looks up path (evidence: `lib/assertions/arrayLength.js`)
- JSON assertion → JSON path lookup: looks up path (evidence: `lib/assertions/json.js`)
- Request debugging → REST API: traces traffic (evidence: `lib/debug.js`)
