# chessurisme/reign architecture

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

- Interactive diagram: https://gitdiagram.com/chessurisme/reign
- Repository: https://github.com/chessurisme/reign

## Overview

Reign is a small browser-side IndexedDB wrapper. A consumer supplies database and store configuration, initializes a connection, then uses the Reign API for record operations and closes the connection. Constructor validation and store normalization support initialization; CRUD methods obtain object stores through the transaction helper. The README also documents existence checks and clearing. The graph reflects sampled runtime code and documented APIs; IndexedDB’s internal persistence behavior is represented at the browser boundary.

Main entry points: [`src/index.js`](https://github.com/chessurisme/reign/blob/main/src/index.js) (Reign API), [`src/create-transaction.js`](https://github.com/chessurisme/reign/blob/main/src/create-transaction.js) (Transaction helper), [`src/verify-parameters.js`](https://github.com/chessurisme/reign/blob/main/src/verify-parameters.js) (Parameter validation), [`src/store-configurations.js`](https://github.com/chessurisme/reign/blob/main/src/store-configurations.js) (Store normalization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public API"]
  node_reign["Reign API<br/>[index.js]"]
end

subgraph group_config["Configuration"]
  node_validation["Parameter validation"]
  node_storeconfig["Store normalization"]
end

subgraph group_operations["Data operations"]
  node_transactions["Transaction helper"]
end

subgraph group_browser["Browser storage"]
  node_indexeddb[("IndexedDB")]
end

node_consumer(("Application"))

node_consumer -->|"calls API"| node_reign
node_reign -->|"validates options"| node_validation
node_reign -->|"normalizes stores"| node_storeconfig
node_reign -->|"opens and upgrades"| node_indexeddb
node_reign -->|"requests store"| node_transactions
node_transactions -->|"creates transaction"| node_indexeddb
node_reign -->|"reads and writes"| node_indexeddb
node_reign -->|"closes connection"| node_indexeddb

click node_reign "https://github.com/chessurisme/reign/blob/main/src/index.js"
click node_validation "https://github.com/chessurisme/reign/blob/main/src/verify-parameters.js"
click node_storeconfig "https://github.com/chessurisme/reign/blob/main/src/store-configurations.js"
click node_transactions "https://github.com/chessurisme/reign/blob/main/src/create-transaction.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_reign toneBlue
class node_validation,node_storeconfig toneAmber
class node_transactions toneMint
class node_indexeddb toneRose
class node_consumer toneIndigo
```

## Components

### Public API

- [Reign API](https://github.com/chessurisme/reign/blob/main/src/index.js): `src/index.js`

### Configuration

- [Parameter validation](https://github.com/chessurisme/reign/blob/main/src/verify-parameters.js): `src/verify-parameters.js`
- [Store normalization](https://github.com/chessurisme/reign/blob/main/src/store-configurations.js): `src/store-configurations.js`

### Data operations

- [Transaction helper](https://github.com/chessurisme/reign/blob/main/src/create-transaction.js): `src/create-transaction.js`

### Browser storage

- **IndexedDB**

### Other components

- **Application**

## Connections

- Application → Reign API: calls API
- Reign API → Parameter validation: validates options
- Reign API → Store normalization: normalizes stores
- Reign API → IndexedDB: opens and upgrades
- Reign API → Transaction helper: requests store
- Transaction helper → IndexedDB: creates transaction
- Reign API → IndexedDB: reads and writes
- Reign API → IndexedDB: closes connection
