# celestiaorg/celestia-app architecture

> Architecture diagram of the GitHub repository celestiaorg/celestia-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/celestiaorg/celestia-app
- Repository: https://github.com/celestiaorg/celestia-app

## Overview

- Blockchain Application (State Machine): Represent the “app” directory which houses core logic like transaction validation, modules (ante handlers, governance, mint, signal, blob, etc.), state exports, genesis, and encoding. This layer is essentially the state machine implemented with Cosmos SDK patterns.
- Command Layer: Illustrate the “cmd/celestia-appd” component that serves as the entry point for launching nodes. It encapsulates configuration and start-up logic.
- Networking and External Communications: Include a block for communications/peer-to-peer networking that supports validator-to-node interactions and block propagation.
- Supporting Modules and Services:
- Modules such as “ante”, “mint”, “minfee”, “signal”, etc. (found under app/, x/ directories, and pkg/). Represent these as functional modules integrated into the application layer.
- gRPC and Protobuf definitions (in proto/ directories) which facilitate external and inter-node RPC calls.
- Local development components (local_devnet) and Docker-related scripts, which help simulate and deploy network configurations.

##### Relationships and Data Flow
- From the External Validator/Client Nodes to the “celestia-appd” command layer.
- From “celestia-appd” to the Application/State Machine (which executes the business logic).
- From the Application layer to the Consensus Engine via the ABCI interface.
- Dependencies, for example:
- The application modules interact with underlying packages (pkg/) and utilize Protobuf for data encoding and event messaging.
- Networking components pass data between validators and consensus nodes.

##### Architectural Patterns and Design Principles
- Use of the Cosmos SDK “modular” architecture pattern where separate modules (ante handlers, posthandlers, governance, etc.) are clearly isolated.
- ABCI pattern: the decoupling of the application state machine from the consensus layer.
- Modular code structure by grouping files into “app”, “cmd”, “pkg”, “proto”, and “x” directories.
- External integrations, such as Docker container definitions and CI/CD workflows (shown in the .github and docker directory), as supporting infrastructure for deployment and testing.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Consensus and Networking Layer
    subgraph "Consensus & Networking Layer"
        CE["Consensus Engine (celestia-core/CometBFT)"]:::consensus
        NET["Networking & P2P"]:::external
    end

    %% ABCI Interface Layer
    subgraph "ABCI Interface Layer"
        ABCI["ABCI Interface"]:::abci
    end

    %% Blockchain Application Layer
    subgraph "Blockchain Application Layer"
        APP["Blockchain App / State Machine (app/)"]:::state
        subgraph "Application Modules"
            ANT["Ante Handlers (app/ante)"]:::module
            MINT["Mint Module (x/mint)"]:::module
            MINFEE["MinFee Module (x/minfee)"]:::module
            SIGNAL["Signal Module (x/signal)"]:::module
            BLOB["Blob Module (x/blob)"]:::module
            BLOBSTREAM["BlobStream Module (x/blobstream)"]:::module
            GRPC["gRPC & Protobuf (proto/)"]:::grpc
        end
    end

    %% Command/CLI Layer
    subgraph "Command/CLI Layer"
        CMD["celestia-appd (cmd/celestia-appd)"]:::cli
    end

    %% Developer & Deployment Tools
    subgraph "Developer & Deployment Tools"
        LOCAL["Local Devnet (local_devnet)"]:::deployment
        DOCKER["Docker & Containerization (docker/)"]:::deployment
        CICD["CI/CD & Automation (.github/workflows)"]:::deployment
        DOCS["Documentation (docs/architecture)"]:::documentation
        TEST["Testing/Utility (test/util/testnode)"]:::testing
    end

    %% Connections
    CMD -->|"initiates"| APP
    APP -->|"viaABCI"| ABCI
    ABCI -->|"communicatesWith"| CE
    CE -->|"sharesDataWith"| NET

    %% Intra-Application Relationships
    APP -->|"integrates"| ANT
    APP -->|"integrates"| MINT
    APP -->|"integrates"| MINFEE
    APP -->|"integrates"| SIGNAL
    APP -->|"integrates"| BLOB
    APP -->|"integrates"| BLOBSTREAM
    APP -->|"utilizes"| GRPC

    %% Developer Tools Connections
    LOCAL --- APP
    DOCKER --- CMD
    CICD --- CMD
    DOCS --- NET
    TEST --- NET

    %% Click Events
    click APP "https://github.com/celestiaorg/celestia-app/tree/main/app/"
    click ANT "https://github.com/celestiaorg/celestia-app/tree/main/app/ante/"
    click CMD "https://github.com/celestiaorg/celestia-app/tree/main/cmd/celestia-appd/"
    click BLOBSTREAM "https://github.com/celestiaorg/celestia-app/blob/main/x/blobstream/abci.go"
    click MINT "https://github.com/celestiaorg/celestia-app/blob/main/x/mint/module.go"
    click MINFEE "https://github.com/celestiaorg/celestia-app/blob/main/x/minfee/module.go"
    click SIGNAL "https://github.com/celestiaorg/celestia-app/blob/main/x/signal/module.go"
    click BLOB "https://github.com/celestiaorg/celestia-app/tree/main/x/blob/"
    click GRPC "https://github.com/celestiaorg/celestia-app/tree/main/proto/"

    %% Styles
    classDef state fill:#f9f,stroke:#333,stroke-width:2px;
    classDef module fill:#ccf,stroke:#333,stroke-width:2px;
    classDef abci fill:#cfc,stroke:#333,stroke-width:2px;
    classDef consensus fill:#fc9,stroke:#333,stroke-width:2px;
    classDef external fill:#cff,stroke:#333,stroke-width:2px;
    classDef cli fill:#f99,stroke:#333,stroke-width:2px;
    classDef deployment fill:#ffa,stroke:#333,stroke-width:2px;
    classDef grpc fill:#efe,stroke:#333,stroke-width:2px;
    classDef documentation fill:#ddd,stroke:#333,stroke-width:2px;
    classDef testing fill:#ddd,stroke:#333,stroke-width:2px;
```
