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

# Configuration reference

> Configure Beam pipeline sources, transforms, and sinks in the Allium App.

Data flows through a Beam pipeline in three stages:

```text theme={null}
source → transforms[] → sinks[]
```

For field types, defaults, and every transform and sink variant, see the [API configuration reference](https://docs.allium.so/beam/api-reference/configuration.md).

## Source

Select a blockchain and entity to stream. Enable **zerolag** to stream from the chain tip before finality, for lower latency at the cost of possible reorged data.

Every chain and entity Beam supports can be picked in the source. If what you need isn't there, check the [Datastreams catalog](https://app.allium.so/build/datastreams) and contact [support@allium.so](mailto:support@allium.so).

## Transforms

Transforms are JavaScript functions. Chain several together; records pass through them in order.

### JavaScript

Filter, modify, enrich, or reshape each record with a JavaScript function. Return `null` to drop the record.

**Example:** keep only logs from the Polygon USDC contract.

```javascript theme={null}
function transform(record) {
  return record.address === "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359" ? record : null;
}
```

> [!WARNING]
>
> Compare against **lowercase** values when filtering by addresses, labels, or symbols. Allium data stores these values in lowercase, and matching is exact.

**Example:** tag each transfer by size.

```javascript theme={null}
function transform(record) {
  const amount = parseFloat(record.amount || "0");
  if (amount > 1000000) {
    record.size_tag = "whale";
  } else if (amount > 10000) {
    record.size_tag = "medium";
  } else {
    record.size_tag = "small";
  }
  return record;
}
```

### Datasets

A dataset is a named list of values that JavaScript transforms check with `beam.contains()`, for a list that is large, changes often, or is shared across pipelines. Create one under **Build > Beam > Datasets**, then add or remove values by pasting them or uploading a `.txt` or `.csv` file. Changes apply to deployed pipelines without a redeploy.

![A dataset with two contract addresses and a membership check](https://mintcdn.com/allium-e770e2b7/2Cik69FC65-mGWej/images/app/beam/dataset.webp?fit=max\&auto=format\&n=2Cik69FC65-mGWej\&q=85\&s=a08e57a4f702210726ee9a6eff357260)

For `beam.contains()` and the datasets API, see [Datasets](https://docs.allium.so/beam/api-reference/datasets/overview.md).

## Sinks

A sink is where the pipeline delivers records. Five types are available: **Kafka**, **SNS**, **External Kafka**, **Webhook**, and **NATS JetStream**.

For every sink field, see the [API configuration reference](https://docs.allium.so/beam/api-reference/configuration.md#sinks).

### External Kafka sinks

Deliver records to your own Kafka cluster instead of an Allium-managed topic.

![External Kafka sink with bootstrap servers, username and password secrets, and auth method](https://mintcdn.com/allium-e770e2b7/2Cik69FC65-mGWej/images/app/beam/external-kafka.webp?fit=max\&auto=format\&n=2Cik69FC65-mGWej\&q=85\&s=a779f936820102fd0eb5b51d47da33c3)

Store your credentials as [organization secrets](https://docs.allium.so/app/organization-management/secrets.md), select the username and password secrets by name, and choose the **Auth Method** (`PLAIN` or `SCRAM-SHA-512`). Connections use `SASL_SSL`.

> [!WARNING]
>
> If a referenced secret changes after the pipeline was last deployed, Beam flags the sink as **stale**. **Redeploy** to apply the new value.

### Webhook sinks

Deliver each record as a POST request to your HTTPS endpoint.

> [!WARNING]
>
> The webhook URL must use HTTPS. Plain HTTP is not supported.

To sign requests and guard against replays, see [Webhook authentication](https://docs.allium.so/beam/webhook-authentication.md).

Set `enable_http_encoding` to `true` to compress each request body with zstd. Beam adds a `Content-Encoding: zstd` header, and your endpoint must decompress the body before parsing it.

Tune delivery to what your endpoint can handle. In the Beam editor, these settings are under **Optional fields** on the webhook sink. Leave a field blank to use its default.

| Field | Default | What it controls |
| :- | :- | :- |
| `max_in_flight` | `64` | Requests sent to your endpoint at once |
| `retries` | `3` | Retries for a failed request |
| `retry_period` | `1s` | Wait between retries |
| `timeout` | `5s` | Time allowed for each request |

`retry_period` and `timeout` take durations such as `500ms`, `30s`, or `1m30s`. Lower `max_in_flight` if your endpoint rate-limits or slows under load. Raise `timeout` if it takes longer than 5 seconds to respond.

### NATS JetStream sinks

Publish records to a JetStream subject on a NATS broker you operate. Set the broker URL and the subject. The subject can include field interpolation, such as `${! json("chain") }`.

Authentication is token-based. Store the token as an [organization secret](https://docs.allium.so/app/organization-management/secrets.md) and reference it with `token_secret_id`. If you omit it, Beam connects without authentication.

> [!WARNING]
>
> Don't put the token in the `url`. When `token_secret_id` is set, Beam adds the token to the connection at deploy time: with a token of `your-token`, `nats://your-broker.example.com:4222` becomes `nats://your-token@your-broker.example.com:4222`.

> [!WARNING]
>
> If the token secret is rotated after deployment, the sink is flagged as **stale**. **Redeploy** to apply the new value.

See the [NATS JetStream sink reference](https://docs.allium.so/beam/api-reference/configuration.md#sinks) for every field.

## Deployment settings

Each pipeline has a pod size and a delivery guarantee, applied the next time it deploys. Pod size runs from XXS to XL, and Beam recommends a size for the source.

| Delivery guarantee | Behavior |
| :- | :- |
| At-least-once (default) | No message loss. The source is backpressured when the pipeline errors. |
| At-most-once | Messages can be lost. The source isn't backpressured on pipeline errors. |

![Deployment settings with pod size and delivery guarantee](https://mintcdn.com/allium-e770e2b7/2Cik69FC65-mGWej/images/app/beam/deployment-settings.webp?fit=max\&auto=format\&n=2Cik69FC65-mGWej\&q=85\&s=5ffb277f22cd6f9973d10d6b2f203102)

## Best practices

1. **Filter early.** Return `null` early in your JavaScript transform to drop records you do not need.
2. **Start simple.** Begin with a filter and add transforms one at a time.
3. **Check health after deploying.** Confirm all workers are healthy.
4. **Handle edge cases in JavaScript.** Guard against missing fields and unexpected types.
5. **Name things clearly.** Descriptive pipeline and sink names make many pipelines easier to manage.
6. **Use lowercase.** Allium data stores addresses, labels, and symbols in lowercase, and matching is exact.
7. **Redeploy instead of tearing down.** Redeploys are idempotent and zero-downtime.
8. **Keep large lists in datasets.** Put allowlists and denylists in a [dataset](#datasets) so you can change them without touching the config.

## Troubleshooting

### Unhealthy workers

1. Check that the config is valid: the source chain and entity exist.
2. Confirm data is available for the selected chain and entity.
3. Fix the config and redeploy. You don't need to tear down.

### Workers running out of memory

1. Simplify JavaScript transforms to use less memory.
2. Filter more aggressively, earlier in the pipeline.
3. Increase the pod size in [deployment settings](#deployment-settings), or contact [support@allium.so](mailto:support@allium.so).

### Crashing workers

1. Check JavaScript transforms for syntax errors.
2. Look for runtime errors in transform logic, such as reading properties of `undefined`.
