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

# Generate fake data

> Use the preloaded `faker` library to produce random test data inline or in the environment.

The [Faker](https://fakerjs.dev/) library is preloaded in every step that
accepts templating, and in **JavaScript** steps via the `faker` global.

## Inline via templating

Any string field supports `{{ }}` expressions:

```
Username: {{ faker.internet.username() }}
Email:    {{ faker.internet.username() }}@usemomentic.com
Lorem:    {{ faker.lorem.words() }}
Index:    the {{ faker.number.int(100) }} item in the list
```

## Persist to the environment

For complex objects or values used across many steps, set them once in a
**JavaScript** step:

```js theme={null}
const person = {
  firstName: faker.person.firstName(),
  lastName: faker.person.lastName(),
  email: faker.internet.email(),
};
setVariable("FAKE_PERSON", person);
```

Then reference in later steps: `{{ env.FAKE_PERSON.firstName }}`.

## Related

* [Variables](/core-concepts/variables)
* [Faker documentation](https://fakerjs.dev/)
