# simplyhexagonal/short-unique-id architecture

> Architecture diagram of the GitHub repository simplyhexagonal/short-unique-id, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/simplyhexagonal/short-unique-id
- Repository: https://github.com/simplyhexagonal/short-unique-id

## Overview

##### Project type and purpose
- This is an open-source, zero-dependency TypeScript/JavaScript library plus CLI tool for generating short unique identifiers (UUIDs) in multiple environments (Node.js, Deno, browsers).

##### File structure
Top-level directories:
- src/           – TypeScript source code for the core library
- bin/           – JavaScript wrappers for the command-line interface (`suid`)
- scripts/       – Build scripts (build, docs, generator, release)
- dist/          – Compiled artifacts: ES-module (`.js`), CommonJS, `.d.ts` definitions
- docs/          – Generated documentation site (HTML, assets)
- specs/         – Unit tests under CJS and ESM configurations
- assets/        – Static templates and policies used by docs and project metadata
Plus config files: package.json, tsconfig.json, typedoc.json, CI workflows

##### README for additional insights
- Describes multi-target packaging (Node, Deno, CDN), CLI usage (`suid`), core API methods (`rnd()`, `seq()`, `stamp()`, `validate()`), documentation site at https://shortunique.id, CI status badge, build/test/release commands.

– Blue for source/build processes
– Green for outputs (dist packages, docs site)
– Orange for external consumers (Node, browser, Deno)
– Gray for CI infrastructure
– Rectangles for code modules/processes

## Diagram (Mermaid)

```mermaid
graph TB
  %% Development Layer
  subgraph "Development Layer"
    SRC["Core Library Module\n(src/)"]:::build
    BIN["CLI Wrapper\n(bin/)"]:::build
    ASSETS["Project Metadata & Assets\n(assets/)"]:::build
    PKG["Package Config\n(package.json,\ntsconfig.json)"]:::config
  end

  %% Testing Suite
  subgraph "Testing Suite"
    CJS["CJS Tests\n(specs/cjs/require.spec.js)"]:::build
    ESM["ESM Tests\n(specs/esm/import.spec.ts)"]:::build
  end

  %% Build & CI Pipeline
  subgraph "Build & CI Pipeline"
    CI["CI Pipeline Config\n(.github/workflows/main.yml)"]:::ci
    SCRIPTS["Build Scripts\n(scripts/)"]:::build
    TYPEDOC["Documentation Config\n(typedoc.json)"]:::config
  end

  %% Distribution Layer
  subgraph "Distribution Layer"
    DIST["Distribution Packages\n(dist/)"]:::output
    DOCS["Generated Docs Site\n(docs/)"]:::output
    NPM["npm Registry"]:::external
    GHPAGES["GitHub Pages"]:::external
    CDN["CDN\n(jsdelivr)"]:::external
  end

  %% Consumption Layer
  subgraph "Consumption"
    NODE["Node.js Apps"]:::external
    DENO["Deno Modules"]:::external
    BROWSER["Browsers"]:::external
    RUNKIT["RunKit Example\n(runkit.js)"]:::external
  end

  %% Development to Testing
  SRC -->|tested by| CJS
  SRC -->|tested by| ESM

  %% CI Flow
  CI -->|runs| CJS
  CI -->|runs| ESM
  CI -->|on success triggers| SCRIPTS
  CI -->|on success triggers| TYPEDOC

  %% Build & Docs
  SCRIPTS -->|compile| DIST
  ASSETS -->|used by| SCRIPTS
  SCRIPTS -->|generate docs| DOCS
  TYPEDOC -->|drives| DOCS

  %% Publish
  SCRIPTS -->|publish| NPM
  SCRIPTS -->|publish| GHPAGES

  %% CLI Wrapper uses library
  BIN -->|imports| DIST

  %% Consumers
  NODE -->|install from| NPM
  DENO -->|import from| CDN
  BROWSER -->|load from| CDN
  RUNKIT -->|demo| CDN

  %% Click Events
  click SRC "https://github.com/simplyhexagonal/short-unique-id/tree/main/src/"
  click BIN "https://github.com/simplyhexagonal/short-unique-id/tree/main/bin/"
  click ASSETS "https://github.com/simplyhexagonal/short-unique-id/tree/main/assets/"
  click PKG "https://github.com/simplyhexagonal/short-unique-id/blob/main/package.json"
  click PKG "https://github.com/simplyhexagonal/short-unique-id/blob/main/tsconfig.json"
  click CJS "https://github.com/simplyhexagonal/short-unique-id/blob/main/specs/cjs/require.spec.js"
  click ESM "https://github.com/simplyhexagonal/short-unique-id/blob/main/specs/esm/import.spec.ts"
  click CI "https://github.com/simplyhexagonal/short-unique-id/blob/main/.github/workflows/main.yml"
  click SCRIPTS "https://github.com/simplyhexagonal/short-unique-id/tree/main/scripts/"
  click TYPEDOC "https://github.com/simplyhexagonal/short-unique-id/blob/main/typedoc.json"
  click DIST "https://github.com/simplyhexagonal/short-unique-id/tree/main/dist/"
  click DOCS "https://github.com/simplyhexagonal/short-unique-id/tree/main/docs/"
  click RUNKIT "https://github.com/simplyhexagonal/short-unique-id/blob/main/runkit.js"

  %% Styles
  classDef build fill:#BBDEFB,stroke:#1E88E5,color:#000
  classDef output fill:#C8E6C9,stroke:#388E3C,color:#000
  classDef external fill:#FFE0B2,stroke:#F57C00,color:#000
  classDef ci fill:#E0E0E0,stroke:#757575,color:#000
  classDef config fill:#E1BEE7,stroke:#8E24AA,color:#000
```
