# cosmos/cosmos-sdk architecture

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

- Interactive diagram: https://gitdiagram.com/cosmos/cosmos-sdk
- Repository: https://github.com/cosmos/cosmos-sdk

## Overview

Cosmos SDK is a modular framework for building sovereign application-specific blockchains. A chain developer composes modules and configures application state; clients construct and broadcast transactions, which the application processes through BaseApp and its module/message routing, then commits state for later queries. The repository also provides client-side query and key tools, shared application and storage abstractions, and snapshot/pruning support. The README documents interoperability and CometBFT compatibility; the sampled excerpts do not establish the wiring of every module or integration.

Main entry points: [`baseapp/baseapp.go`](https://github.com/cosmos/cosmos-sdk/blob/main/baseapp/baseapp.go) (BaseApp), [`baseapp/msg_service_router.go`](https://github.com/cosmos/cosmos-sdk/blob/main/baseapp/msg_service_router.go) (Message routing), [`baseapp/state/manager.go`](https://github.com/cosmos/cosmos-sdk/blob/main/baseapp/state/manager.go) (Execution state), [`baseapp/abci.go`](https://github.com/cosmos/cosmos-sdk/blob/main/baseapp/abci.go) (ABCI lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application runtime"]
  node_baseapp["BaseApp<br/>[baseapp.go]"]
  node_abci["ABCI lifecycle<br/>[abci.go]"]
  node_router["Message routing"]
  node_appmodule["Module framework<br/>[module.go]"]
end

subgraph group_tx["Transactions and clients"]
  node_clienttx["Transaction builder<br/>[tx.go]"]
  node_broadcast["Transaction broadcast<br/>[broadcast.go]"]
  node_clientquery["Query client<br/>[query.go]"]
end

subgraph group_modules["Chain capabilities"]
  node_bank["Bank capability<br/>[query.pb.go]"]
  node_staking["Staking capability<br/>[query.pb.go]"]
  node_governance["Governance API<br/>[query.pulsar.go]"]
end

subgraph group_state["State and persistence"]
  node_state["Execution state<br/>[manager.go]"]
  node_storage["Block storage views<br/>[storage.go]"]
  node_snapshot["Snapshot manager<br/>[manager.go]"]
  node_pruning["Pruning manager<br/>[manager.go]"]
  node_collections["State collections<br/>[collections.go]"]
end

subgraph group_interfaces["APIs and integration"]
  node_api["Generated service APIs<br/>[service_grpc.pb.go]"]
end

node_developer(("Chain developer"))
node_operator(("Chain operator"))
node_txuser(("Transaction user"))
node_comet["CometBFT"]
node_ibc["IBC integration"]

node_developer -->|"composes modules"| node_appmodule
node_appmodule -->|"configures application"| node_baseapp
node_txuser -->|"builds transaction"| node_clienttx
node_clienttx -->|"provides transaction"| node_broadcast
node_broadcast -->|"broadcasts transaction"| node_comet
node_comet -->|"invokes lifecycle"| node_abci
node_abci -->|"runs application"| node_baseapp
node_baseapp -->|"dispatches messages"| node_router
node_router -.->|"routes module messages"| node_bank
node_router -.->|"routes module messages"| node_staking
node_baseapp -->|"selects execution state"| node_state
node_state -->|"exposes store views"| node_storage
node_operator -->|"manages snapshots"| node_snapshot
node_snapshot -->|"announces snapshot heights"| node_pruning
node_state -.->|"uses state abstractions"| node_collections
node_clientquery -->|"issues service queries"| node_api
node_developer -.->|"adds interoperability"| node_ibc
node_governance -->|"defines query messages"| node_api

click node_clienttx "https://github.com/cosmos/cosmos-sdk/blob/main/client/tx/tx.go"
click node_broadcast "https://github.com/cosmos/cosmos-sdk/blob/main/client/broadcast.go"
click node_clientquery "https://github.com/cosmos/cosmos-sdk/blob/main/client/query.go"
click node_baseapp "https://github.com/cosmos/cosmos-sdk/blob/main/baseapp/baseapp.go"
click node_abci "https://github.com/cosmos/cosmos-sdk/blob/main/baseapp/abci.go"
click node_router "https://github.com/cosmos/cosmos-sdk/blob/main/baseapp/msg_service_router.go"
click node_appmodule "https://github.com/cosmos/cosmos-sdk/blob/main/core/appmodule/module.go"
click node_bank "https://github.com/cosmos/cosmos-sdk/blob/main/x/bank/types/query.pb.go"
click node_staking "https://github.com/cosmos/cosmos-sdk/blob/main/x/staking/types/query.pb.go"
click node_governance "https://github.com/cosmos/cosmos-sdk/blob/main/api/cosmos/gov/v1/query.pulsar.go"
click node_state "https://github.com/cosmos/cosmos-sdk/blob/main/baseapp/state/manager.go"
click node_storage "https://github.com/cosmos/cosmos-sdk/blob/main/internal/blockstm/storage.go"
click node_snapshot "https://github.com/cosmos/cosmos-sdk/blob/main/store/snapshots/manager.go"
click node_pruning "https://github.com/cosmos/cosmos-sdk/blob/main/store/pruning/manager.go"
click node_collections "https://github.com/cosmos/cosmos-sdk/blob/main/collections/collections.go"
click node_api "https://github.com/cosmos/cosmos-sdk/blob/main/api/cosmos/tx/v1beta1/service_grpc.pb.go"

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_baseapp,node_abci,node_router,node_appmodule,node_txuser toneBlue
class node_clienttx,node_broadcast,node_clientquery toneAmber
class node_bank,node_staking,node_governance toneMint
class node_state,node_storage,node_snapshot,node_pruning,node_collections toneRose
class node_api,node_developer,node_operator,node_comet,node_ibc toneIndigo
```

## Components

### Application runtime

- [BaseApp](https://github.com/cosmos/cosmos-sdk/blob/main/baseapp/baseapp.go): `baseapp/baseapp.go`
- [ABCI lifecycle](https://github.com/cosmos/cosmos-sdk/blob/main/baseapp/abci.go): `baseapp/abci.go`
- [Message routing](https://github.com/cosmos/cosmos-sdk/blob/main/baseapp/msg_service_router.go): `baseapp/msg_service_router.go`
- [Module framework](https://github.com/cosmos/cosmos-sdk/blob/main/core/appmodule/module.go): `core/appmodule/module.go`

### Transactions and clients

- [Transaction builder](https://github.com/cosmos/cosmos-sdk/blob/main/client/tx/tx.go): `client/tx/tx.go`
- [Transaction broadcast](https://github.com/cosmos/cosmos-sdk/blob/main/client/broadcast.go): `client/broadcast.go`
- [Query client](https://github.com/cosmos/cosmos-sdk/blob/main/client/query.go): `client/query.go`

### Chain capabilities

- [Bank capability](https://github.com/cosmos/cosmos-sdk/blob/main/x/bank/types/query.pb.go): `x/bank/types/query.pb.go`
- [Staking capability](https://github.com/cosmos/cosmos-sdk/blob/main/x/staking/types/query.pb.go): `x/staking/types/query.pb.go`
- [Governance API](https://github.com/cosmos/cosmos-sdk/blob/main/api/cosmos/gov/v1/query.pulsar.go): `api/cosmos/gov/v1/query.pulsar.go`

### State and persistence

- [Execution state](https://github.com/cosmos/cosmos-sdk/blob/main/baseapp/state/manager.go): `baseapp/state/manager.go`
- [Block storage views](https://github.com/cosmos/cosmos-sdk/blob/main/internal/blockstm/storage.go): `internal/blockstm/storage.go`
- [Snapshot manager](https://github.com/cosmos/cosmos-sdk/blob/main/store/snapshots/manager.go): `store/snapshots/manager.go`
- [Pruning manager](https://github.com/cosmos/cosmos-sdk/blob/main/store/pruning/manager.go): `store/pruning/manager.go`
- [State collections](https://github.com/cosmos/cosmos-sdk/blob/main/collections/collections.go): `collections/collections.go`

### APIs and integration

- [Generated service APIs](https://github.com/cosmos/cosmos-sdk/blob/main/api/cosmos/tx/v1beta1/service_grpc.pb.go): `api/cosmos/tx/v1beta1/service_grpc.pb.go`

### Other components

- **Chain developer**
- **Chain operator**
- **Transaction user**
- **CometBFT**
- **IBC integration**

## Connections

- Chain developer → Module framework: composes modules
- Module framework → BaseApp: configures application
- Transaction user → Transaction builder: builds transaction
- Transaction builder → Transaction broadcast: provides transaction
- Transaction broadcast → CometBFT: broadcasts transaction
- CometBFT → ABCI lifecycle: invokes lifecycle
- ABCI lifecycle → BaseApp: runs application
- BaseApp → Message routing: dispatches messages
- Message routing → Bank capability: routes module messages
- Message routing → Staking capability: routes module messages
- BaseApp → Execution state: selects execution state
- Execution state → Block storage views: exposes store views
- Chain operator → Snapshot manager: manages snapshots
- Snapshot manager → Pruning manager: announces snapshot heights
- Execution state → State collections: uses state abstractions
- Query client → Generated service APIs: issues service queries
- Chain developer → IBC integration: adds interoperability
- Governance API → Generated service APIs: defines query messages
