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

# Rust SDK overview

> The facade crate, optional adapters, and the main producer/runtime types.

The `headgate` crate is the application-facing facade. It re-exports core envelope and
outcome types, the `Task` derive, producer client, registry, worker, contexts, extensions,
steps, scheduling, plugins, and test helpers.

```toml theme={"system"}
[dependencies]
headgate = "0.1"
headgate-postgres = "0.1"
serde = { version = "1", features = ["derive"] }
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
```

Add `headgate-workflow` for durable DAGs or `headgate-crypto` for client-side encrypted
payloads. Both are opt-in layers and keep database drivers out of core.

## Main types

| Type           | Role                                               |
| -------------- | -------------------------------------------------- |
| `Client`       | Validated producer boundary                        |
| `Envelope`     | Durable job and policy inputs                      |
| `Task`         | Typed payload codec and metadata                   |
| `Registry`     | Kind/version dispatch table                        |
| `Worker`       | Admission, heartbeat, execution, shutdown          |
| `JobCtx`       | Attempt identity, logging, output, progress, steps |
| `WorkerConfig` | Queues, capacity, leases, polling, telemetry       |

<CardGroup cols={2}>
  <Card title="Define tasks" icon="braces" href="/docs/sdk/rust/tasks" />

  <Card title="Run workers" icon="server" href="/docs/sdk/rust/worker" />
</CardGroup>
