# hyperlane-xyz/hyperlane-monorepo architecture

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

- Interactive diagram: https://gitdiagram.com/hyperlane-xyz/hyperlane-monorepo
- Repository: https://github.com/hyperlane-xyz/hyperlane-monorepo

## Overview

1. **This is a multi-language protocol monorepo, not a single app.**  
   Hyperlane v3 is an interchain messaging system. The repo is split into four major runtime surfaces: Solidity contracts, Rust agents, TypeScript SDK/ops tooling, and chain-specific program crates for non-EVM ecosystems. The architecture is centered on moving messages and token state across chains, with shared config and deployment tooling tying everything together.

2. **The on-chain core is the protocol boundary.**  
   The Solidity workspace contains the main protocol contracts for EVM-style chains: Mailbox, hooks, ISMs, interchain gas payment, validator announce, and warp-route token contracts. These contracts are the canonical source of truth for dispatching messages, verifying remote messages, and handling token bridge flows. Similar contract/program implementations exist for Tron, Starknet, Cosmos, Solana/Sealevel, Radix, Aleo, Fuel, and others via their respective chain packages.

3. **Off-chain agents provide the protocol’s operational layer.**  
   The Rust `agents` workspace contains the long-running services that observe chains and submit transactions:  
   - **scraper** indexes on-chain events into a database  
   - **relayer** reconstructs message context and submits deliveries  
   - **validator** observes checkpoints / Merkle data and publishes validator attestations  
   These agents are the main off-chain executors that turn on-chain state transitions into cross-chain delivery actions.

4. **Message flow is event-driven: dispatch → index → relay → deliver.**  
   A sender dispatches a message on an origin chain through a mailbox. The scraper indexes dispatches, deliveries, gas payments, and related metadata into persistent storage. The relayer reads that indexed state, fetches any required proofs / metadata from chain-specific providers, then submits the message on the destination chain. The destination mailbox and ISM verify the message before it is processed by the recipient application.

5. **Validators and Merkle state are a separate trust/attestation lane.**  
   The validator subsystem tracks checkpoints and Merkle tree insertions, and the repo includes tooling and server endpoints around proof generation and insertion queries. This supports the protocol’s authentication path: validators announce state, relayers assemble proofs, and destination chains verify them via ISMs.

6. **Warp routes are the token-bridge specialization of the same protocol.**  
   “Warp” is Hyperlane’s token transfer layer. The repo has dedicated token modules, route readers/writers, and deployment/config logic for native, collateral, synthetic, and cross-collateral flows. Warp route state depends on the same core primitives as messaging—mailbox, gas payment, ISM, validator announce—but adds token-specific balance, fee, and rebalancing behavior.

7. **The TypeScript SDK family is the control plane for deployments and chain integration.**  
   The `typescript/sdk` family and chain-specific SDKs expose reusable abstractions for reading, deploying, and interacting with Hyperlane modules. These packages adapt the same protocol concepts to different chains and execution models. They are used by CLIs, infra scripts, deployment flows, tests, and application code to generate artifacts, build transactions, and resolve chain metadata.

8. **The CLI and deployment tooling are the human/operator interface.**  
   `typescript/cli` and `typescript/infra` provide command-line workflows for deploying core contracts, ISMs, hooks, warp routes, validators, and relayer configs. They also cover reading state, submitting governance changes, generating configs, and performing checks. These tools consume the shared config model and emit chain-specific deployment actions.

9. **Infrastructure is config-driven and environment-specific.**  
   The repo includes extensive environment definitions, Helm charts, Terraform, and external-secret integration. This layer defines how agents and services are deployed to Kubernetes, how secrets and RPC URLs are supplied, and how chain/route/validator inventories differ between testnet and mainnet. In practice, infra is the bridge between protocol code and production operations.

10. **Monitoring and observability are first-class subsystems.**  
   Metrics are implemented across Rust and TypeScript packages and exported to Prometheus/Grafana. There are dedicated services for fee quoting, HTTP registry, warp monitoring, and CCIP-related server functionality. These are not just ancillary utilities; they are part of the operational feedback loop used to detect liveness, balance health, relayer state, and deployment correctness.

11. **Persistent state is split by responsibility.**  
   The scraper uses a relational database with migrations for canonical indexed protocol data. Agents also use local durable state and caches for runtime coordination and recovery. This separation matters architecturally: indexed protocol history lives in the scraper DB, while agent-local runtime state supports retry, nonce management, and submission orchestration.

12. **The repo is intentionally chain-abstracted but chain-specialized at the edges.**  
   Shared Hyperlane concepts live in common crates/packages: message types, metadata builders, provider abstractions, and protocol traits. Each chain family then implements adapters for its own RPC model, signing model, transaction format, and account layout. That means the diagram should show a shared protocol core in the middle, with per-chain adapter layers fanning out to EVM, Cosmos, Solana/Sealevel, Starknet, Tron, Aleo, Radix, Fuel, and others.

13. **Tests and fixtures validate both protocol semantics and chain-specific behavior.**  
   The repository is heavily fixture-driven, with end-to-end suites across chain families plus mock responses and local environments. This indicates the architecture relies on realistic chain emulation and deployment harnesses, not just unit tests. For a diagram, that means test/harness infrastructure should be shown as a parallel validation plane alongside the production runtime.

Main entry points: [`rust/main/hyperlane-core`](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/hyperlane-core) (Core types), [`solidity/contracts`](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/solidity/contracts) (Core contracts), [`rust/main`](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main) (Agents workspace), [`typescript/sdk`](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/sdk) (SDK family)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_solidity["Solidity protocol"]
  node_solidity_core["Core contracts<br/>solidity protocol"]
  node_solidity_warp["Warp token contracts<br/>solidity bridge"]
  node_solidity_interfaces["Protocol interfaces<br/>solidity abi"]
end

subgraph group_rust["Rust runtime"]
  node_rust_agents["Agents workspace<br/>rust orchestration"]
  node_rust_scraper[("Scraper<br/>rust indexer")]
  node_rust_relayer["Relayer<br/>rust delivery"]
  node_rust_validator["Validator<br/>rust attestor"]
  node_rust_base["Base runtime<br/>rust shared runtime"]
  node_rust_core["Core types<br/>rust protocol core"]
  node_rust_ethereum["EVM adapter<br/>rust chain adapter"]
  node_rust_cosmos["Cosmos adapter<br/>rust chain adapter"]
  node_rust_sealevel["Sealevel adapter<br/>rust chain adapter"]
end

subgraph group_typescript["TypeScript control plane"]
  node_typescript_sdk["SDK family<br/>typescript SDKs"]
  node_typescript_cli["CLI"]
  node_typescript_infra["Infra<br/>typescript ops"]
  node_typescript_services["Operator services<br/>typescript service layer"]
  node_typescript_rebalancer["Rebalancer<br/>typescript inventory service"]
  node_typescript_monitoring["Metrics stack<br/>typescript observability"]
end

subgraph group_sealevel["Sealevel programs"]
  node_sealevel_programs["Programs"]
  node_sealevel_sdk["SVM SDK<br/>typescript sealevel sdk"]
end

subgraph group_ops["Infra and observability"]
  node_ops_config["Environments<br/>ops config"]
  node_ops_observability["Monitoring infra<br/>ops deployment"]
end

node_solidity_core -->|"exposes"| node_solidity_interfaces
node_solidity_core -->|"primitives for"| node_solidity_warp
node_rust_agents -->|"uses"| node_rust_base
node_rust_agents -->|"contains"| node_rust_scraper
node_rust_agents -->|"contains"| node_rust_relayer
node_rust_agents -->|"contains"| node_rust_validator
node_rust_relayer -->|"depends on"| node_rust_core
node_rust_scraper -->|"indexes via"| node_rust_core
node_rust_validator -->|"attests via"| node_rust_core
node_rust_ethereum -->|"implements"| node_rust_core
node_rust_cosmos -->|"implements"| node_rust_core
node_rust_sealevel -->|"implements"| node_rust_core
node_typescript_sdk -->|"binds"| node_solidity_interfaces
node_typescript_sdk -->|"shares types"| node_rust_core
node_typescript_cli -->|"uses"| node_typescript_sdk
node_typescript_infra -->|"drives"| node_typescript_cli
node_typescript_infra -->|"loads"| node_ops_config
node_typescript_services -->|"uses"| node_typescript_sdk
node_typescript_rebalancer -->|"uses"| node_typescript_sdk
node_typescript_monitoring -->|"observes"| node_typescript_services
node_sealevel_programs -->|"served by"| node_sealevel_sdk
node_sealevel_sdk -->|"integrates with"| node_typescript_cli
node_ops_observability -->|"deploys"| node_typescript_monitoring
node_ops_config -->|"configures"| node_solidity_core
node_ops_config -->|"configures"| node_rust_agents
node_ops_config -->|"configures"| node_sealevel_programs
node_solidity_core -->|"verifies messages for"| node_rust_relayer
node_solidity_core -->|"consumes attestations from"| node_rust_validator
node_solidity_warp -->|"token flows for"| node_typescript_rebalancer

click node_solidity_core "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/solidity/contracts"
click node_solidity_warp "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/solidity/contracts/token"
click node_solidity_interfaces "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/solidity/contracts/interfaces"
click node_rust_agents "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main"
click node_rust_scraper "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/agents/scraper"
click node_rust_relayer "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/agents/relayer"
click node_rust_validator "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/agents/validator"
click node_rust_base "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/hyperlane-base"
click node_rust_core "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/hyperlane-core"
click node_rust_ethereum "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/chains/hyperlane-ethereum"
click node_rust_cosmos "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/chains/hyperlane-cosmos"
click node_rust_sealevel "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/chains/hyperlane-sealevel"
click node_typescript_sdk "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/sdk"
click node_typescript_cli "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/cli"
click node_typescript_infra "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/infra"
click node_typescript_services "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/fee-quoting"
click node_typescript_rebalancer "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/rebalancer"
click node_typescript_monitoring "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/metrics"
click node_sealevel_programs "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/sealevel/programs"
click node_sealevel_sdk "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/svm-sdk"
click node_ops_config "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/infra/config/environments"
click node_ops_observability "https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/infra/helm"

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_solidity_core,node_solidity_warp,node_solidity_interfaces toneBlue
class node_rust_agents,node_rust_scraper,node_rust_relayer,node_rust_validator,node_rust_base,node_rust_core,node_rust_ethereum,node_rust_cosmos,node_rust_sealevel toneAmber
class node_typescript_sdk,node_typescript_cli,node_typescript_infra,node_typescript_services,node_typescript_rebalancer,node_typescript_monitoring toneMint
class node_sealevel_programs,node_sealevel_sdk toneRose
class node_ops_config,node_ops_observability toneIndigo
```

## Components

### Solidity protocol

EVM-facing on-chain contracts and token bridge modules.

- [Core contracts](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/solidity/contracts): solidity protocol · Mailbox, hooks, ISMs, IGP, and validator announce for EVM chains. · `solidity/contracts`
- [Warp token contracts](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/solidity/contracts/token): solidity bridge · Token bridge specialization built on the core messaging primitives. · `solidity/contracts/token`
- [Protocol interfaces](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/solidity/contracts/interfaces): solidity abi · Shared contract and interface surface used by SDKs and chain adapters. · `solidity/contracts/interfaces`

### Rust runtime

Long-running agents and chain adapters in Rust.

- [Agents workspace](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main): rust orchestration · Top-level Rust workspace for protocol agents and shared runtime crates. · `rust/main`
- [Scraper](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/agents/scraper): rust indexer · Indexes chain events into relational storage for downstream consumers. · `rust/main/agents/scraper`
- [Relayer](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/agents/relayer): rust delivery · Builds message context, proofs, and submits cross-chain deliveries. · `rust/main/agents/relayer`
- [Validator](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/agents/validator): rust attestor · Observes checkpoints and publishes validator attestations and queries. · `rust/main/agents/validator`
- [Base runtime](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/hyperlane-base): rust shared runtime · Shared agent/server/settings/cache foundations used across Rust binaries. · `rust/main/hyperlane-base`
- [Core types](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/hyperlane-core): rust protocol core · Shared protocol types, Merkle/accumulator logic, RPC traits, and config primitives. · `rust/main/hyperlane-core`
- [EVM adapter](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/chains/hyperlane-ethereum): rust chain adapter · Ethereum/EVM contract bindings, RPC clients, signers, and tx submission. · `rust/main/chains/hyperlane-ethereum`
- [Cosmos adapter](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/chains/hyperlane-cosmos): rust chain adapter · CosmWasm and native Cosmos implementations for mailbox, ISM, and IGP. · `rust/main/chains/hyperlane-cosmos`
- [Sealevel adapter](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/main/chains/hyperlane-sealevel): rust chain adapter · Solana/SVM chain support, indexers, providers, and transaction plumbing. · `rust/main/chains/hyperlane-sealevel`

### TypeScript control plane

SDKs, CLIs, deployment tooling, and operator services.

- [SDK family](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/sdk): typescript SDKs · Protocol clients, adapters, signers, providers, and deployment abstractions. · `typescript/sdk`
- [CLI](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/cli): typescript operator cli · Human-facing workflows for deploy, read, check, relay, and warp operations. · `typescript/cli`
- [Infra](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/infra): typescript ops · Environment config, deployment scripts, Helm, secrets, funding, and governance tooling. · `typescript/infra`
- [Operator services](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/fee-quoting): typescript service layer · Fee quoting, registry, CCIP server, relayer tooling, and monitoring services. · `typescript/fee-quoting`
- [Rebalancer](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/rebalancer): typescript inventory service · Inventory balancing orchestration, strategy selection, and bridge execution. · `typescript/rebalancer`
- [Metrics stack](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/metrics): typescript observability · Shared metrics, warp monitoring, key funding, and dashboards. · `typescript/metrics`

### Sealevel programs

Solana/SVM programs, clients, and environments.

- [Programs](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/sealevel/programs): sealevel on-chain programs · Mailbox, ISM, IGP, validator announce, and warp token programs for SVM. · `rust/sealevel/programs`
- [SVM SDK](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/svm-sdk): typescript sealevel sdk · TypeScript bindings and artifact managers for Solana/SVM protocol modules. · `typescript/svm-sdk`

### Infra and observability

Deployment, configuration, monitoring, and environment management.

- [Environments](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/infra/config/environments): ops config · Chain inventories, validator sets, warp routes, and deployment environments. · `typescript/infra/config/environments`
- [Monitoring infra](https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/typescript/infra/helm): ops deployment · Helm charts and dashboards for agents, fee quoting, warp monitoring, and registry services. · `typescript/infra/helm`

## Connections

- Core contracts → Protocol interfaces: exposes · Core contracts define the canonical protocol ABI surface.
- Core contracts → Warp token contracts: primitives for · Warp routes reuse mailbox, ISM, and gas payment primitives.
- Agents workspace → Base runtime: uses · Agents share the common runtime, settings, server, and cache foundations.
- Agents workspace → Scraper: contains · The scraper is the indexing and persistence surface.
- Agents workspace → Relayer: contains · The relayer is the delivery orchestration surface.
- Agents workspace → Validator: contains · The validator is the attestation surface.
- Relayer → Core types: depends on · Relaying depends on shared message, proof, and Merkle primitives.
- Scraper → Core types: indexes via · Scraper models protocol data with shared core types.
- Validator → Core types: attests via · Validator checkpoint and Merkle handling uses shared core primitives.
- EVM adapter → Core types: implements · EVM chain support is built on the shared protocol core.
- Cosmos adapter → Core types: implements · Cosmos and CosmWasm chain support is built on the shared protocol core.
- Sealevel adapter → Core types: implements · SVM chain support is built on the shared protocol core.
- SDK family → Protocol interfaces: binds · SDKs read and write protocol contracts through generated bindings and readers.
- SDK family → Core types: shares types · SDKs mirror protocol concepts, messages, and metadata across runtimes.
- CLI → SDK family: uses · CLI workflows are composed from SDK deployment and interaction abstractions.
- Infra → CLI: drives · Infra scripts invoke CLI-like deployment and validation workflows.
- Infra → Environments: loads · Operational behavior is driven by environment-specific config inventories.
- Operator services → SDK family: uses · Services rely on SDK primitives for chain access and protocol operations.
- Rebalancer → SDK family: uses · Rebalancing logic uses SDKs for chain reads, bridge actions, and token abstractions.
- Metrics stack → Operator services: observes · Metrics and dashboards cover operator services and their liveness.
- Programs → SVM SDK: served by · Programs are deployed and interacted with through the SVM SDK.
- SVM SDK → CLI: integrates with · CLI supports SVM-specific deployment, read, and warp workflows through the SDK.
- Monitoring infra → Metrics stack: deploys · Helm and observability templates deploy metrics and monitoring services.
- Environments → Core contracts: configures · Environment inventories point at chain deployments and owners.
- Environments → Agents workspace: configures · Agent environments define runtime settings, RPCs, and inventories.
- Environments → Programs: configures · Sealevel environments define program IDs, warp routes, and validator settings.
- Core contracts → Relayer: verifies messages for · Destination-side contracts verify the messages relayed by off-chain agents.
- Core contracts → Validator: consumes attestations from · Core verification paths consume validator announcements and checkpoint data.
- Warp token contracts → Rebalancer: token flows for · Warp routes feed inventory management and rebalancing workflows.
