# movementlabsxyz/movement architecture

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

- Interactive diagram: https://gitdiagram.com/movementlabsxyz/movement
- Repository: https://github.com/movementlabsxyz/movement

## Overview

Based on our analysis of the file-tree and README, the Movement SDK project is a modular toolkit intended for building, deploying, and managing Movement Labs’ infrastructure and networking nodes. The project is a complex, multi-component system that spans from developer tool scripts, build configurations, and Docker orchestration to core protocol implementations and node runtime services.

##### Main Components
- Developer / Build Environment:
– Nix shell environment (as noted in the README) which provides a consistent development toolchain.
– Cargo (Rust build system) for compiling many components.
– “just” and the scripts (in the scripts/ folder) which are used to drive builds and tests.
- Orchestration and Containerization:
– Dockerfiles (in docker/) and Docker Compose configurations (in docker/compose/ and process-compose/) that orchestrate the services.
- Protocol and Node Infrastructure:
– “protocol-units/” holds the building blocks/microservice-like modules that implement network protocols.
– “networks/” contains the entry points and configuration needed for running node clusters as well as network-specific runners (for full nodes, indexers, etc.).
- Core Node Software:
– Components like “movement-celestia-da-light-node” and “movement-full-node” (including native and Docker runners) which give you the actual node services. These interact with underlying data availability systems (e.g., Celestia) and settlement chains (such as Ethereum) as described in the README.
- Utilities and Libraries:
– “util/” provides various utility crates: common functions, cryptography, signing, logging/tracing, and helper tools.
- Interface Definitions:
– “proto/” holds protocol buffer definitions used to generate APIs for the Movement Network.
- Additional Modules:
– “benches/”, “demo/”, and network-specific directories contain examples, test interfaces, or experimental features.

##### Relationships and Interactions
- The developer environment (Nix, Cargo, Just, and scripts) forms the foundation, managing the build and testing pipeline.
- Core Node Software (movement-full-node, movement-celestia-da-light-node) interacts with underlying blockchain components:
– A local or networked Celestia Data Availability service (with variants: “local”, “arabica”, “mocha”) and Ethereum networks (local and Holesky) for settlement.
– REST APIs (e.g., Aptos REST API, Aptos Faucet API) are exposed by node software.
- Protocol Units are the modular logic blocks that encapsulate protocol functionality. They interact with the nodes and are orchestrated via the network runners.
- The Docker and process-compose setups encapsulate these node instances and services so they can be deployed and run in a containerized environment.
- Utility libraries provide support for tasks such as signing, cryptography (e.g., via util/signing, util/movement-types), and storage. They are used by both core services and protocol units.

##### Architectural Patterns and Design Principles
- Modularity and Extensibility: The discrete separation into directories such as “protocol-units”, “networks”, and “util” shows that components are designed to be pluggable and extensible.
- Layered Architecture: The system is composed of a build/developer layer, an orchestration layer (Docker/just/scripts), and the runtime node/protocol layer.
- Microservice-like Deployment: Docker Compose and process-compose files are used to run services individually (e.g., full node, indexer, da-light node), which are connected via network interfaces.
- Separation of Concerns: Each directory has a focused role—whether it’s protocol definitions (proto), low-level protocol functionality (protocol-units), or network runners (networks).

##### Relevant Technologies and Tools
- Languages and Build Tools: Rust and Cargo are predominant, with Move modules in some parts. The build environment uses Nix.
- Containerization: Docker and Compose files are crucial.
- Scripting: “just” commands and various shell scripts help manage workflows.
- Utilities: Various utility libraries (cryptography, tracing, signing, etc.) support core operations.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Developer / Build Environment
    subgraph "Developer / Build Environment"
        DE1[".cargo"]
        DE2["Cargo.toml"]
        DE3["Cargo.lock"]
        DE4["rust-toolchain.toml"]
        DS1["justfile"]
        DS2["scripts/"]
    end

    %% Orchestration and Containerization
    subgraph "Orchestration and Containerization"
        O1["docker/build/movement-full-node/Dockerfile"]
        O2["docker/compose/"]
        O3["process-compose/"]
    end

    %% Protocol and Node Infrastructure
    subgraph "Protocol and Node Infrastructure"
        P1["protocol-units/"]
        P2["networks/"]
        P3["proto/"]
    end

    %% Core Node Software
    subgraph "Core Node Software"
        C1["networks/movement/movement-full-node"]
        C2["networks/movement/indexer"]
        C3["networks/movement/movement-client"]
    end

    %% Utilities and Libraries
    subgraph "Utilities and Libraries"
        U1["util/"]
        U2["util/movement-types"]
        U3["util/signing"]
    end

    %% Additional Modules
    subgraph "Additional Modules"
        A1["benches/"]
        A2["demo/"]
    end

    %% Relationships and Data Flow
    DE2 -->|"builds"| O2
    DS1 -->|"triggers"| O3
    DE2 -->|"compiles"| P1
    DE2 -->|"compiles"| C1
    O1 -->|"deploys"| C1
    O2 -->|"orchestrates"| C2
    O2 -->|"orchestrates"| C3
    P1 -->|"feeds"| C1
    P2 -->|"configures"| C1
    C1 -->|"exposes"| P3
    C1 -->|"uses"| U1
    C2 -->|"uses"| U1
    C3 -->|"uses"| U1
    DS2 -->|"assists"| U3
    A1 -->|"tests"| C2
    A2 -->|"demonstrates"| C3

    %% Click Events for Developer / Build Environment
    click DE1 "https://github.com/movementlabsxyz/movement/blob/main/.cargo"
    click DE2 "https://github.com/movementlabsxyz/movement/blob/main/Cargo.toml"
    click DE3 "https://github.com/movementlabsxyz/movement/blob/main/Cargo.lock"
    click DE4 "https://github.com/movementlabsxyz/movement/blob/main/rust-toolchain.toml"
    click DS1 "https://github.com/movementlabsxyz/movement/tree/main/justfile"
    click DS2 "https://github.com/movementlabsxyz/movement/tree/main/scripts/"

    %% Click Events for Orchestration and Containerization
    click O1 "https://github.com/movementlabsxyz/movement/tree/main/docker/build/movement-full-node/Dockerfile"
    click O2 "https://github.com/movementlabsxyz/movement/tree/main/docker/compose/"
    click O3 "https://github.com/movementlabsxyz/movement/tree/main/process-compose/"

    %% Click Events for Protocol and Node Infrastructure
    click P1 "https://github.com/movementlabsxyz/movement/tree/main/protocol-units/"
    click P2 "https://github.com/movementlabsxyz/movement/tree/main/networks/"
    click P3 "https://github.com/movementlabsxyz/movement/tree/main/proto/"

    %% Click Events for Core Node Software
    click C1 "https://github.com/movementlabsxyz/movement/tree/main/networks/movement/movement-full-node"
    click C2 "https://github.com/movementlabsxyz/movement/tree/main/networks/movement/indexer"
    click C3 "https://github.com/movementlabsxyz/movement/tree/main/networks/movement/movement-client"

    %% Click Events for Utilities and Libraries
    click U1 "https://github.com/movementlabsxyz/movement/tree/main/util/"
    click U2 "https://github.com/movementlabsxyz/movement/tree/main/util/movement-types"
    click U3 "https://github.com/movementlabsxyz/movement/tree/main/util/signing"

    %% Click Events for Additional Modules
    click A1 "https://github.com/movementlabsxyz/movement/tree/main/benches/"
    click A2 "https://github.com/movementlabsxyz/movement/tree/main/demo/"

    %% Styles
    classDef developer fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef orchestration fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef protocol fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef core fill:#FF6347,stroke:#000,stroke-width:2px;
    classDef utilities fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef additional fill:#F0E68C,stroke:#000,stroke-width:2px;

    class DE1,DE2,DE3,DE4,DS1,DS2 developer;
    class O1,O2,O3 orchestration;
    class P1,P2,P3 protocol;
    class C1,C2,C3 core;
    class U1,U2,U3 utilities;
    class A1,A2 additional;
```
