# escodb/core architecture

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

- Interactive diagram: https://gitdiagram.com/escodb/core
- Repository: https://github.com/escodb/core

## Overview

Escodb Core is an end-to-end encrypted document store designed for cloud storage. The intended user workflow is to configure or open a Store, address documents by path, and persist encrypted data through a selected adapter; the tree also indicates sharding, scheduling, and task execution as distinct internal stages. The README is empty and Store’s implementation was not sampled, so its orchestration links are not asserted. The explicit links shown come from the sampled exports, Router, Context, and key-sequence cipher code.

Main entry points: [`lib/ciphers/key_sequence.js`](https://github.com/escodb/core/blob/main/lib/ciphers/key_sequence.js) (Key sequence), [`exports/web_exports.js`](https://github.com/escodb/core/blob/main/exports/web_exports.js) (Web exports), [`exports/node_exports.js`](https://github.com/escodb/core/blob/main/exports/node_exports.js) (Node exports), [`lib/ciphers/context.js`](https://github.com/escodb/core/blob/main/lib/ciphers/context.js) (Encryption context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Store API"]
  node_node_exports["Node exports<br/>[node_exports.js]"]
  node_web_exports["Web exports<br/>[web_exports.js]"]
  node_store["Document store<br/>[store.js]"]
  node_config["Store configuration"]
end

subgraph group_storage["Storage and layout"]
  node_adapters["Storage adapters"]
  node_web_storage["Web storage adapter<br/>[web_storage.js]"]
  node_router["Path router<br/>[router.js]"]
  node_shard["Shard handling<br/>[shard.js]"]
  node_cache["Cache<br/>[cache.js]"]
end

subgraph group_security["Encryption and integrity"]
  node_context["Encryption context<br/>[context.js]"]
  node_cipher_suite["Cipher suite"]
  node_key_sequence["Key sequence<br/>[key_sequence.js]"]
  node_cell["Encrypted cell<br/>[cell.js]"]
  node_verifier["Metadata verifier<br/>[verifier.js]"]
  node_crypto["Crypto backends"]
  node_format["Binary and canonical format"]
end

subgraph group_execution["Scheduling and execution"]
  node_schedule["Operation scheduler<br/>[schedule.js]"]
  node_task["Task model<br/>[task.js]"]
  node_executor["Task executor<br/>[executor.js]"]
  node_sync["Concurrency primitives"]
end

node_application(("Application"))
node_browser_storage[("Browser storage")]

node_application -->|"imports"| node_node_exports
node_application -->|"imports"| node_web_exports
node_node_exports -->|"exports"| node_store
node_web_exports -->|"exports"| node_store
node_web_exports -->|"exports"| node_adapters
node_web_storage -->|"reads and writes"| node_browser_storage
node_router -->|"signs paths"| node_crypto
node_context -->|"canonical-encodes"| node_format
node_key_sequence -->|"stores keys in"| node_cell
node_key_sequence -->|"encrypts with"| node_cipher_suite
node_key_sequence -->|"encodes key data"| node_format
node_key_sequence -->|"verifies metadata"| node_verifier
node_key_sequence -->|"serializes key access"| node_sync
node_key_sequence -->|"builds contexts"| node_context
node_cell -->|"uses"| node_cipher_suite

click node_node_exports "https://github.com/escodb/core/blob/main/exports/node_exports.js"
click node_web_exports "https://github.com/escodb/core/blob/main/exports/web_exports.js"
click node_store "https://github.com/escodb/core/blob/main/lib/store.js"
click node_config "https://github.com/escodb/core/tree/main/lib/config"
click node_adapters "https://github.com/escodb/core/tree/main/lib/adapters"
click node_web_storage "https://github.com/escodb/core/blob/main/lib/adapters/web_storage.js"
click node_router "https://github.com/escodb/core/blob/main/lib/router.js"
click node_shard "https://github.com/escodb/core/blob/main/lib/shard.js"
click node_cache "https://github.com/escodb/core/blob/main/lib/cache.js"
click node_context "https://github.com/escodb/core/blob/main/lib/ciphers/context.js"
click node_cipher_suite "https://github.com/escodb/core/tree/main/lib/ciphers"
click node_key_sequence "https://github.com/escodb/core/blob/main/lib/ciphers/key_sequence.js"
click node_cell "https://github.com/escodb/core/blob/main/lib/cell.js"
click node_verifier "https://github.com/escodb/core/blob/main/lib/verifier.js"
click node_crypto "https://github.com/escodb/core/tree/main/lib/crypto"
click node_format "https://github.com/escodb/core/tree/main/lib/format"
click node_schedule "https://github.com/escodb/core/blob/main/lib/schedule.js"
click node_task "https://github.com/escodb/core/blob/main/lib/task.js"
click node_executor "https://github.com/escodb/core/blob/main/lib/executor.js"
click node_sync "https://github.com/escodb/core/tree/main/lib/sync"

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_node_exports,node_web_exports,node_store,node_config toneBlue
class node_adapters,node_web_storage,node_router,node_shard,node_cache,node_browser_storage toneAmber
class node_context,node_cipher_suite,node_key_sequence,node_cell,node_verifier,node_crypto,node_format toneMint
class node_schedule,node_task,node_executor,node_sync toneRose
class node_application toneIndigo
```

## Components

### Store API

- [Node exports](https://github.com/escodb/core/blob/main/exports/node_exports.js): `exports/node_exports.js`
- [Web exports](https://github.com/escodb/core/blob/main/exports/web_exports.js): `exports/web_exports.js`
- [Document store](https://github.com/escodb/core/blob/main/lib/store.js): `lib/store.js`
- [Store configuration](https://github.com/escodb/core/tree/main/lib/config): `lib/config`

### Storage and layout

- [Storage adapters](https://github.com/escodb/core/tree/main/lib/adapters): `lib/adapters`
- [Web storage adapter](https://github.com/escodb/core/blob/main/lib/adapters/web_storage.js): `lib/adapters/web_storage.js`
- [Path router](https://github.com/escodb/core/blob/main/lib/router.js): `lib/router.js`
- [Shard handling](https://github.com/escodb/core/blob/main/lib/shard.js): `lib/shard.js`
- [Cache](https://github.com/escodb/core/blob/main/lib/cache.js): `lib/cache.js`

### Encryption and integrity

- [Encryption context](https://github.com/escodb/core/blob/main/lib/ciphers/context.js): `lib/ciphers/context.js`
- [Cipher suite](https://github.com/escodb/core/tree/main/lib/ciphers): `lib/ciphers`
- [Key sequence](https://github.com/escodb/core/blob/main/lib/ciphers/key_sequence.js): `lib/ciphers/key_sequence.js`
- [Encrypted cell](https://github.com/escodb/core/blob/main/lib/cell.js): `lib/cell.js`
- [Metadata verifier](https://github.com/escodb/core/blob/main/lib/verifier.js): `lib/verifier.js`
- [Crypto backends](https://github.com/escodb/core/tree/main/lib/crypto): `lib/crypto`
- [Binary and canonical format](https://github.com/escodb/core/tree/main/lib/format): `lib/format`

### Scheduling and execution

- [Operation scheduler](https://github.com/escodb/core/blob/main/lib/schedule.js): `lib/schedule.js`
- [Task model](https://github.com/escodb/core/blob/main/lib/task.js): `lib/task.js`
- [Task executor](https://github.com/escodb/core/blob/main/lib/executor.js): `lib/executor.js`
- [Concurrency primitives](https://github.com/escodb/core/tree/main/lib/sync): `lib/sync`

### Other components

- **Application**
- **Browser storage**

## Connections

- Application → Node exports: imports
- Application → Web exports: imports
- Node exports → Document store: exports
- Web exports → Document store: exports
- Web exports → Storage adapters: exports
- Web storage adapter → Browser storage: reads and writes
- Path router → Crypto backends: signs paths
- Encryption context → Binary and canonical format: canonical-encodes
- Key sequence → Encrypted cell: stores keys in
- Key sequence → Cipher suite: encrypts with
- Key sequence → Binary and canonical format: encodes key data
- Key sequence → Metadata verifier: verifies metadata
- Key sequence → Concurrency primitives: serializes key access
- Key sequence → Encryption context: builds contexts
- Encrypted cell → Cipher suite: uses
