# bitgo/bitgojs architecture

> Architecture diagram of the GitHub repository bitgo/bitgojs, 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/bitgo/bitgojs
- Repository: https://github.com/bitgo/bitgojs

## Overview

BitGoJS is a monorepo SDK for building cryptocurrency applications, centered on managing BitGo wallets and constructing and signing transactions across many networks. The principal workflow is an application using the SDK to access a wallet and coin implementation, then build/sign a transaction and interact with BitGo’s co-signing platform. The repository also includes a local signing proxy, chain-specific transaction libraries, public explorer access, and specialized Lightning, passkey, key-card, and Babylon staking capabilities. The README and tree support this high-level map; sampled source confirms selected Express, Lightning, and staking paths, but not every subsystem’s internal wiring.

Main entry points: [`modules/bitgo/src/v2/coins/index.ts`](https://github.com/bitgo/bitgojs/blob/master/modules/bitgo/src/v2/coins/index.ts) (Coin implementations), [`modules/bitgo/src/bitgo.ts`](https://github.com/bitgo/bitgojs/blob/master/modules/bitgo/src/bitgo.ts) (BitGo client), [`modules/sdk-api/src/v1/wallet.ts`](https://github.com/bitgo/bitgojs/blob/master/modules/sdk-api/src/v1/wallet.ts) (Wallet API), [`modules/bitgo/src/v2/coinFactory.ts`](https://github.com/bitgo/bitgojs/blob/master/modules/bitgo/src/v2/coinFactory.ts) (Coin factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["SDK client"]
  node_bitgo["BitGo client<br/>[bitgo.ts]"]
  node_wallets["Wallet API<br/>[wallet.ts]"]
  node_coinfactory["Coin factory<br/>[coinFactory.ts]"]
end

subgraph group_chains["Chain transactions"]
  node_coinimpl["Coin implementations<br/>[index.ts]"]
  node_account["Account transactions<br/>[index.ts]"]
  node_utxo["UTXO transactions"]
  node_eth["Ethereum transactions"]
  node_cosmos["Cosmos transactions<br/>[index.ts]"]
  node_substrate["Substrate transactions"]
  node_statics["Chain configuration<br/>[config.ts]"]
end

subgraph group_services["Signing services"]
  node_express["Local signing proxy<br/>[expressApp.ts]"]
  node_routehandlers["Wallet route handlers<br/>[clientRoutes.ts]"]
  node_lightningroutes["Lightning routes"]
  node_signer["Lightning signer"]
end

subgraph group_special["Specialized capabilities"]
  node_lightningwallet["Lightning wallets<br/>[wallet.ts]"]
  node_explorers["Block explorer APIs<br/>[index.ts]"]
  node_keycard["Key cards<br/>[index.ts]"]
  node_passkey["Passkey crypto<br/>[index.ts]"]
  node_babylon["Babylon BTC staking<br/>[manager.ts]"]
  node_stakingadapter["BitGo staking adapter<br/>[stakingManager.ts]"]
end

node_app(("SDK consumer"))
node_platform["BitGo platform"]

node_app -->|"uses SDK"| node_bitgo
node_bitgo -->|"accesses wallets"| node_wallets
node_bitgo -->|"selects coin"| node_coinfactory
node_coinfactory -->|"creates coin"| node_coinimpl
node_coinimpl -->|"builds transactions"| node_account
node_coinimpl -->|"builds transactions"| node_utxo
node_coinimpl -->|"builds transactions"| node_eth
node_coinimpl -->|"builds transactions"| node_cosmos
node_coinimpl -->|"builds transactions"| node_substrate
node_coinimpl -->|"uses configuration"| node_statics
node_wallets -->|"calls platform API"| node_platform
node_express -->|"dispatches routes"| node_routehandlers
node_routehandlers -->|"uses wallet API"| node_wallets
node_lightningroutes -->|"invokes wallet"| node_lightningwallet
node_signer -->|"uses wallet data"| node_lightningwallet
node_app -->|"uses proxy"| node_express
node_app -->|"queries explorers"| node_explorers
node_app -->|"uses key-card tools"| node_keycard
node_app -->|"uses passkey tools"| node_passkey
node_app -->|"creates staking manager"| node_stakingadapter
node_stakingadapter -->|"extends manager"| node_babylon

click node_bitgo "https://github.com/bitgo/bitgojs/blob/master/modules/bitgo/src/bitgo.ts"
click node_wallets "https://github.com/bitgo/bitgojs/blob/master/modules/sdk-api/src/v1/wallet.ts"
click node_coinfactory "https://github.com/bitgo/bitgojs/blob/master/modules/bitgo/src/v2/coinFactory.ts"
click node_coinimpl "https://github.com/bitgo/bitgojs/blob/master/modules/bitgo/src/v2/coins/index.ts"
click node_account "https://github.com/bitgo/bitgojs/blob/master/modules/account-lib/src/index.ts"
click node_utxo "https://github.com/bitgo/bitgojs/blob/master/modules/abstract-utxo/src/abstractUtxoCoin.ts"
click node_eth "https://github.com/bitgo/bitgojs/blob/master/modules/abstract-eth/src/abstractEthLikeCoin.ts"
click node_cosmos "https://github.com/bitgo/bitgojs/blob/master/modules/abstract-cosmos/src/index.ts"
click node_substrate "https://github.com/bitgo/bitgojs/blob/master/modules/abstract-substrate/src/abstractSubstrateCoin.ts"
click node_statics "https://github.com/bitgo/bitgojs/blob/master/modules/abstract-utxo/src/config.ts"
click node_express "https://github.com/bitgo/bitgojs/blob/master/modules/express/src/expressApp.ts"
click node_routehandlers "https://github.com/bitgo/bitgojs/blob/master/modules/express/src/clientRoutes.ts"
click node_lightningroutes "https://github.com/bitgo/bitgojs/blob/master/modules/express/src/lightning/lightningInvoiceRoutes.ts"
click node_lightningwallet "https://github.com/bitgo/bitgojs/blob/master/modules/abstract-lightning/src/wallet/wallet.ts"
click node_signer "https://github.com/bitgo/bitgojs/blob/master/modules/express/src/lightning/lightningSignerRoutes.ts"
click node_explorers "https://github.com/bitgo/bitgojs/blob/master/modules/blockapis/src/index.ts"
click node_keycard "https://github.com/bitgo/bitgojs/blob/master/modules/key-card/src/index.ts"
click node_passkey "https://github.com/bitgo/bitgojs/blob/master/modules/passkey-crypto/src/index.ts"
click node_babylon "https://github.com/bitgo/bitgojs/blob/master/modules/babylonlabs-io-btc-staking-ts/src/staking/manager.ts"
click node_stakingadapter "https://github.com/bitgo/bitgojs/blob/master/modules/utxo-staking/src/babylon/stakingManager.ts"

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_bitgo,node_wallets,node_coinfactory toneBlue
class node_coinimpl,node_account,node_utxo,node_eth,node_cosmos,node_substrate,node_statics toneAmber
class node_express,node_routehandlers,node_lightningroutes,node_signer toneMint
class node_lightningwallet,node_explorers,node_keycard,node_passkey,node_babylon,node_stakingadapter toneRose
class node_app,node_platform toneIndigo
```

## Components

### SDK client

- [BitGo client](https://github.com/bitgo/bitgojs/blob/master/modules/bitgo/src/bitgo.ts): `modules/bitgo/src/bitgo.ts`
- [Wallet API](https://github.com/bitgo/bitgojs/blob/master/modules/sdk-api/src/v1/wallet.ts): `modules/sdk-api/src/v1/wallet.ts`
- [Coin factory](https://github.com/bitgo/bitgojs/blob/master/modules/bitgo/src/v2/coinFactory.ts): `modules/bitgo/src/v2/coinFactory.ts`

### Chain transactions

- [Coin implementations](https://github.com/bitgo/bitgojs/blob/master/modules/bitgo/src/v2/coins/index.ts): `modules/bitgo/src/v2/coins/index.ts`
- [Account transactions](https://github.com/bitgo/bitgojs/blob/master/modules/account-lib/src/index.ts): `modules/account-lib/src/index.ts`
- [UTXO transactions](https://github.com/bitgo/bitgojs/blob/master/modules/abstract-utxo/src/abstractUtxoCoin.ts): `modules/abstract-utxo/src/abstractUtxoCoin.ts`
- [Ethereum transactions](https://github.com/bitgo/bitgojs/blob/master/modules/abstract-eth/src/abstractEthLikeCoin.ts): `modules/abstract-eth/src/abstractEthLikeCoin.ts`
- [Cosmos transactions](https://github.com/bitgo/bitgojs/blob/master/modules/abstract-cosmos/src/index.ts): `modules/abstract-cosmos/src/index.ts`
- [Substrate transactions](https://github.com/bitgo/bitgojs/blob/master/modules/abstract-substrate/src/abstractSubstrateCoin.ts): `modules/abstract-substrate/src/abstractSubstrateCoin.ts`
- [Chain configuration](https://github.com/bitgo/bitgojs/blob/master/modules/abstract-utxo/src/config.ts): `modules/abstract-utxo/src/config.ts`

### Signing services

- [Local signing proxy](https://github.com/bitgo/bitgojs/blob/master/modules/express/src/expressApp.ts): `modules/express/src/expressApp.ts`
- [Wallet route handlers](https://github.com/bitgo/bitgojs/blob/master/modules/express/src/clientRoutes.ts): `modules/express/src/clientRoutes.ts`
- [Lightning routes](https://github.com/bitgo/bitgojs/blob/master/modules/express/src/lightning/lightningInvoiceRoutes.ts): `modules/express/src/lightning/lightningInvoiceRoutes.ts`
- [Lightning signer](https://github.com/bitgo/bitgojs/blob/master/modules/express/src/lightning/lightningSignerRoutes.ts): `modules/express/src/lightning/lightningSignerRoutes.ts`

### Specialized capabilities

- [Lightning wallets](https://github.com/bitgo/bitgojs/blob/master/modules/abstract-lightning/src/wallet/wallet.ts): `modules/abstract-lightning/src/wallet/wallet.ts`
- [Block explorer APIs](https://github.com/bitgo/bitgojs/blob/master/modules/blockapis/src/index.ts): `modules/blockapis/src/index.ts`
- [Key cards](https://github.com/bitgo/bitgojs/blob/master/modules/key-card/src/index.ts): `modules/key-card/src/index.ts`
- [Passkey crypto](https://github.com/bitgo/bitgojs/blob/master/modules/passkey-crypto/src/index.ts): `modules/passkey-crypto/src/index.ts`
- [Babylon BTC staking](https://github.com/bitgo/bitgojs/blob/master/modules/babylonlabs-io-btc-staking-ts/src/staking/manager.ts): `modules/babylonlabs-io-btc-staking-ts/src/staking/manager.ts`
- [BitGo staking adapter](https://github.com/bitgo/bitgojs/blob/master/modules/utxo-staking/src/babylon/stakingManager.ts): `modules/utxo-staking/src/babylon/stakingManager.ts`

### Other components

- **SDK consumer**
- **BitGo platform**

## Connections

- SDK consumer → BitGo client: uses SDK
- BitGo client → Wallet API: accesses wallets
- BitGo client → Coin factory: selects coin
- Coin factory → Coin implementations: creates coin
- Coin implementations → Account transactions: builds transactions
- Coin implementations → UTXO transactions: builds transactions
- Coin implementations → Ethereum transactions: builds transactions
- Coin implementations → Cosmos transactions: builds transactions
- Coin implementations → Substrate transactions: builds transactions
- Coin implementations → Chain configuration: uses configuration
- Wallet API → BitGo platform: calls platform API
- Local signing proxy → Wallet route handlers: dispatches routes
- Wallet route handlers → Wallet API: uses wallet API
- Lightning routes → Lightning wallets: invokes wallet
- Lightning signer → Lightning wallets: uses wallet data
- SDK consumer → Local signing proxy: uses proxy
- SDK consumer → Block explorer APIs: queries explorers
- SDK consumer → Key cards: uses key-card tools
- SDK consumer → Passkey crypto: uses passkey tools
- SDK consumer → BitGo staking adapter: creates staking manager
- BitGo staking adapter → Babylon BTC staking: extends manager
