> Part of the walkerOS documentation. Project overview and full index: <https://www.walkeros.io/llms.txt>

# Code Destination

A destination does not need a package. Pass an object with a `push` function as `code`, and the collector calls it for every event, like any other destination. Use it to run a few lines of your own code on events.

Where this fits

Code is a **destination** in the walkerOS flow:

Runs your own `push` function on each event, without a package.

## Integrated[​](#integrated "Direct link to Integrated")

```typescript
import { startFlow } from '@walkeros/collector';

const { elb } = await startFlow({
  destinations: {
    console: {
      code: {
        type: 'console',
        config: {},
        push: (event) => {
          console.log('Event:', event.name, event.data);
        },
      },
    },
  },
});
```

## Bundled[​](#bundled "Direct link to Bundled")

In a `flow.json`, write the function as a `$code:` string:

```json
"destinations": {
  "console": {
    "code": {
      "type": "console",
      "push": "$code:(event) => { console.log('Event:', event.name, event.data); }"
    }
  }
}
```

The rules for `code` in a flow file are in [Inline code](/preview/pr-749/docs/getting-started/flow.md#inline-code-without-packages).

Set `consent`, `mapping` and the other destination options in `config` beside `code`, as for any destination. In integrated mode the object can implement the whole [destination interface](/preview/pr-749/docs/destinations/create-your-own.md). `batch` needs a `pushBatch` function, which only the integrated form can provide: a flow file's `code` takes only `type`, `init` and `push`.
