> ## Documentation Index
> Fetch the complete documentation index at: https://docs.goldsky.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Build Offchain-x-Onchain Systems with Compose

Compose is the offchain-to-onchain framework for high-stakes systems. It lets you write code that durably moves money, data, and events between every platform you use, whether it's offchain or onchain.

Write simple TypeScript code that runs in verifiable sandboxes, with auditable datastores and traceable functions. Monitor the input and output of every mutation in production, and use TEE-powered attestations to prove that your logic actually ran as intended.

<Card title="Jump to quickstart" icon="download" href="/compose/quick-start">
  Run our install script to get all necessary dependencies and instantly generate your first Compose App.
</Card>

## Use Cases

<CardGroup cols={2}>
  <Card title="Custom price/data feeds" icon="chart-line">
    Tailored to your app's logic and update cadence
  </Card>

  <Card title="Custom oracles" icon="circle-dot">
    Trustless, verifiable and auditable data sources
  </Card>

  <Card title="Circuit breakers" icon="shield-alert">
    Detect anomalies and pause or reroute activity
  </Card>

  <Card title="Prediction market resolution" icon="target">
    Market data ingestion with application-specific rules
  </Card>

  <Card title="Identity and attestation flows" icon="shield-check">
    Verify offchain facts (KYC/AML, account status) and write onchain attestations
  </Card>

  <Card title="Scheduled tasks and keepers" icon="calendar-clock">
    Rebalance strategies, payouts, or maintenance windows
  </Card>

  <Card title="Cross-chain coordination" icon="git-branch">
    Read across chains and external APIs then write atomically, anywhere
  </Card>

  <Card title="Offchain notifications" icon="bell">
    Triggered notifications from onchain events with guaranteed delivery
  </Card>
</CardGroup>

## How it Works

Every Compose app can have multiple tasks, which can be triggered through on-chain events, cron-like scheduling, or an API.

Tasks will run in auditable sandboxes with immutable tracing on every single function call that interfaces with the external world. State is fully versioned and tracked, and execution is persisted through any unforeseen downtime.

* **Ultracompliance:** Write your code in your local environment, and run exactly the same code in our cloud environment or in a Trusted Executable Environment (TEE).
* **Actually useful sandboxes:** Task code runs in a sandbox, but can call safe functions that interact with the outside world.
* **Trace everything**: Every step of every task is traced. Our CLI and UI allows you to step through every single task execution down to the function calls.

## Architecture

```mermaid theme={null}
flowchart TB
    subgraph external["External Systems and Clients"]
        EXT[" "]
    end

    subgraph services["External Services"]
        HTTP((HTTP Calls))
        BC((Blockchains))
        SDB[(Stage DB)]
    end

    subgraph sandbox["Secure Task Sandbox"]
        direction TB
        TASK[Compose Task Process]
        NOTE["Only communicates via IPC bus"]
    end

    ES[(Event Storage)]

    EXT -->|"HTTP task trigger"| HOST
    EXT -->|"Cron trigger"| HOST
    EXT -->|"Audit query"| ES

    HTTP <-->|"fetch"| HOST
    BC <-->|"reads/writes"| HOST
    SDB <-->|"cross-task state"| HOST

    HOST[Compose Host] <-->|"Task run\ntrigger/response"| TASK
    HOST <-->|"Host function\nrequest/response"| TASK
    HOST -->|"Log events"| ES
```

Compose executes tasks in secure and auditable sandboxes which route all external communication through the Compose host, leveraging it for durability handling and guaranteed execution.

Every single function call that mutates state (databases, blockchains) or accesses external resources will be tracked, with inputs and outputs saved. This is accessible through a UI for tracing or debugging purposes.

The task sandbox is completely isolated and can be run as a Trusted Executable Environment or as a normal container. **The same code can be used in all environments.** Code run in a TEE will also generate attestations, with guarantees that the code run is exactly the code you intend, with no side effects.

Get started by [setting up your first Compose application](/compose/quick-start) in under 5 minutes.
