# mystenlabs/ts-sdks architecture

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

- Interactive diagram: https://gitdiagram.com/mystenlabs/ts-sdks
- Repository: https://github.com/mystenlabs/ts-sdks

## Overview

##### Main system domains and components
- Monorepo “Root”
– Package manager & workspace: pnpm, pnpm-workspace.yaml
– Monorepo runner: TurboRepo (turbo.json)
– Lint/build/test scripts (package.json at root)
– CI/CD orchestrator: GitHub Actions workflows under .github/workflows
- SDK Packages
By logical area:
1. Core client & transport
– packages/typescript/src/client
– packages/graphql-transport
– packages/utils
– packages/bcs
2. Cryptography & key management
– packages/typescript/src/cryptography
– packages/signers (aws, gcp, ledger, webcrypto)
– packages/seal (homomorphic, encryption)
– packages/move-bytecode-template (template engine)
3. Transaction building & codegen
– packages/codegen
– packages/kiosk
– packages/deepbook / deepbook-v3
– packages/zksend
4. Wallet & UI kits
– packages/dapp-kit
– packages/dapp-kit-next
– packages/create-dapp (CLI + templates)
– packages/enoki / enoki-connect / slush-wallet / window-wallet-core
– packages/wallet-standard
5. Data layers & misc tools
– packages/mvr-static (static builders)
– packages/utils
- Documentation site
– packages/docs (Next.js + MDX)
– Content pulls from packages’ typedoc.json and readmes
- Test infrastructure
– Unit tests: Vitest, Jest in each package
– E2E tests: testcontainers + Docker
- External services
– Docker daemon (for e2e testcontainers)
– GitHub (source host, Actions runner)
– npm registry (package publishing)

##### Inter-package relationships
– Core client (typescript) ← uses → BCS, cryptography, transport, utils
– codegen ← reads schemas → graphql-transport, Move modules in tests → generates TS code
– dapp-kit-next and dapp-kit ← both import → typescript client & wallet-standard
– create-dapp CLI ← scaffolds → template projects (that pull in dapp-kit or enoki)
– enoki-connect / window-wallet-core → provide wallet-channel abstraction consumed by UI kits
– kiosk ← uses → BCS + client transport to build kiosk transactions
- Test harness dependencies
– E2E tests ← orchestrated by → testcontainers (Docker)
– Unit tests ← run via → Vitest/Jest configured in each package

##### Architectural patterns & design principles
- Monorepo modularity: each package is a self-contained library with its own tsconfig, README, tests
- Shared infrastructure: build scripts (packages/build-scripts), shared ESLint and Prettier configs
- CI/CD pipelines: parallel & incremental builds via TurboRepo; custom workflows for publishing changesets
- Separation of concerns:
– Core blockchain client
– Cryptography & key handling
– Transaction builders and code generation
– Wallet connectivity & UI
– Documentation

##### Special notes for this monorepo
– Emphasize the workspace root orchestrator (pnpm + turbo) as the entry point for builds/tests
– Capture shared-config layers (.eslintrc.js, prettier.config.js, changesets at .changeset/)
– Show how create-dapp, enoki, and slush-wallet provide templates or demo dapps that depend on core SDKs
– Illustrate documentation site pulling in typedoc outputs from each package

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo Root
    subgraph "Monorepo Root"
        direction TB
        pnpm["pnpm-workspace.yaml"]:::monorepo
        turbo["turbo.json"]:::monorepo
        rootpkg["package.json (root)"]:::monorepo
        eslint[".eslintrc.js"]:::monorepo
        prettier["prettier.config.js"]:::monorepo
    end

    %% Core Client & Transport
    subgraph "Core Client & Transport"
        direction TB
        client["packages/typescript/src/client"]:::core
        graphql["packages/graphql-transport"]:::core
        utils["packages/utils"]:::core
        bcs["packages/bcs"]:::core
    end

    %% Cryptography & Key Management
    subgraph "Cryptography & Key Management"
        direction TB
        crypto["packages/typescript/src/cryptography"]:::crypto
        signers["packages/signers"]:::crypto
        seal["packages/seal"]:::crypto
        template["packages/move-bytecode-template"]:::crypto
    end

    %% Transaction Building & Code Generation
    subgraph "Transaction Builders & Codegen"
        direction TB
        codegen["packages/codegen"]:::tx
        kiosk["packages/kiosk"]:::tx
        deepbook["packages/deepbook"]:::tx
        deepbookv3["packages/deepbook-v3"]:::tx
        zksend["packages/zksend"]:::tx
    end

    %% Wallet & UI Kits
    subgraph "Wallet & UI Kits"
        direction TB
        dappkit["packages/dapp-kit"]:::ui
        dappkitnext["packages/dapp-kit-next"]:::ui
        createdapp["packages/create-dapp"]:::ui
        enoki["packages/enoki"]:::ui
        enokiconnect["packages/enoki-connect"]:::ui
        slushwallet["packages/slush-wallet"]:::ui
        windowwallet["packages/window-wallet-core"]:::ui
        walletstd["packages/wallet-standard"]:::ui
    end

    %% Data Layers & Misc Tools
    subgraph "Data Layers & Misc Tools"
        direction TB
        mvrstatic["packages/mvr-static"]:::misc
        utils2["packages/utils"]:::misc
    end

    %% Documentation
    subgraph "Documentation Site"
        direction TB
        docs["packages/docs"]:::docs
        typedoc["packages/docs/typedoc.json"]:::docs
    end

    %% CI/CD Orchestration
    subgraph "CI/CD Orchestration"
        direction TB
        workflowsT[".github/workflows/turborepo.yml"]:::ci
        e2ewf[".github/workflows/e2e.yml"]:::ci
        changesets[".changeset/"]:::ci
        sealci[".github/workflows/seal-ci.yml"]:::ci
    end

    %% External Services
    subgraph "External Services"
        direction TB
        docker["Docker/Testcontainers"]:::external
        github["GitHub Actions Runner"]:::external
        npm["npm Registry"]:::external
    end

    %% Dependencies & Flows
    rootpkg -->|orchestrates| turbo
    turbo -->|build/test| client
    turbo -->|build/test| crypto
    turbo -->|build/test| codegen
    turbo -->|build/test| dappkit

    workflowsT -->|runs pipeline| turbo
    workflowsT -->|triggers| workflowsT
    e2ewf -->|runs E2E tests| docker

    client -->|imports| bcs
    client -->|imports| utils
    client -->|imports| graphql
    client -->|imports| crypto

    codegen -->|reads schemas| graphql
    codegen -->|generates code from| template

    kiosk -->|uses| bcs
    kiosk -->|uses| client

    dappkit -->|imports| client
    dappkit -->|imports| walletstd
    dappkitnext -->|imports| client
    dappkitnext -->|imports| walletstd

    createdapp -->|scaffolds| dappkit
    createdapp -->|scaffolds| enoki

    enokiconnect -->|provides| dappkit
    windowwallet -->|provides| dappkitnext

    mvrstatic -->|builds static| template
    utils2 -->|shared functions| client

    docs -->|pulls typedoc| typedoc
    docs -->|documents| client

    workflowsT -->|publishes| npm
    changesets -->|manage releases| npm
    github -->|hosts| workflowsT

    e2ewf -->|orchestrates| docker

    %% Click Events
    click pnpm "https://github.com/mystenlabs/ts-sdks/blob/main/pnpm-workspace.yaml"
    click turbo "https://github.com/mystenlabs/ts-sdks/blob/main/turbo.json"
    click rootpkg "https://github.com/mystenlabs/ts-sdks/blob/main/package.json"
    click eslint "https://github.com/mystenlabs/ts-sdks/blob/main/.eslintrc.js"
    click prettier "https://github.com/mystenlabs/ts-sdks/blob/main/prettier.config.js"
    click client "https://github.com/mystenlabs/ts-sdks/tree/main/packages/typescript/src/client"
    click graphql "https://github.com/mystenlabs/ts-sdks/tree/main/packages/graphql-transport"
    click utils "https://github.com/mystenlabs/ts-sdks/tree/main/packages/utils"
    click bcs "https://github.com/mystenlabs/ts-sdks/tree/main/packages/bcs"
    click crypto "https://github.com/mystenlabs/ts-sdks/tree/main/packages/typescript/src/cryptography"
    click signers "https://github.com/mystenlabs/ts-sdks/tree/main/packages/signers"
    click seal "https://github.com/mystenlabs/ts-sdks/tree/main/packages/seal"
    click template "https://github.com/mystenlabs/ts-sdks/tree/main/packages/move-bytecode-template"
    click codegen "https://github.com/mystenlabs/ts-sdks/tree/main/packages/codegen"
    click kiosk "https://github.com/mystenlabs/ts-sdks/tree/main/packages/kiosk"
    click deepbook "https://github.com/mystenlabs/ts-sdks/tree/main/packages/deepbook"
    click deepbookv3 "https://github.com/mystenlabs/ts-sdks/tree/main/packages/deepbook-v3"
    click zksend "https://github.com/mystenlabs/ts-sdks/tree/main/packages/zksend"
    click dappkit "https://github.com/mystenlabs/ts-sdks/tree/main/packages/dapp-kit"
    click dappkitnext "https://github.com/mystenlabs/ts-sdks/tree/main/packages/dapp-kit-next"
    click createdapp "https://github.com/mystenlabs/ts-sdks/tree/main/packages/create-dapp"
    click enoki "https://github.com/mystenlabs/ts-sdks/tree/main/packages/enoki"
    click enokiconnect "https://github.com/mystenlabs/ts-sdks/tree/main/packages/enoki-connect"
    click slushwallet "https://github.com/mystenlabs/ts-sdks/tree/main/packages/slush-wallet"
    click windowwallet "https://github.com/mystenlabs/ts-sdks/tree/main/packages/window-wallet-core"
    click walletstd "https://github.com/mystenlabs/ts-sdks/tree/main/packages/wallet-standard"
    click mvrstatic "https://github.com/mystenlabs/ts-sdks/tree/main/packages/mvr-static"
    click docs "https://github.com/mystenlabs/ts-sdks/tree/main/packages/docs"
    click typedoc "https://github.com/mystenlabs/ts-sdks/blob/main/packages/docs/typedoc.json"
    click workflowsT "https://github.com/mystenlabs/ts-sdks/blob/main/.github/workflows/turborepo.yml"
    click e2ewf "https://github.com/mystenlabs/ts-sdks/blob/main/.github/workflows/e2e.yml"
    click sealci "https://github.com/mystenlabs/ts-sdks/blob/main/.github/workflows/seal-ci.yml"
    click changesets "https://github.com/mystenlabs/ts-sdks/tree/main/.changeset/"
    click docker "https://github.com/mystenlabs/ts-sdks/blob/main/packages/typescript/docker-compose.yml"

    %% Styles
    classDef monorepo fill:#d3d3d3,stroke:#666
    classDef core fill:#bbe1fa,stroke:#0275d8
    classDef crypto fill:#e0bbff,stroke:#8a2be2
    classDef tx fill:#b2fab4,stroke:#008000
    classDef ui fill:#ffd8b1,stroke:#ff8c00
    classDef misc fill:#b1faff,stroke:#17a2b8
    classDef docs fill:#aff8db,stroke:#20c997
    classDef ci fill:#c0c0c0,stroke:#343a40
    classDef external fill:#f8d7da,stroke:#dc3545
```
