---
id: "uuid-generator"
type: "component"
kind: "id-generator"
provider: "default"
category: "data"
docs: "https://datatracker.ietf.org/doc/html/rfc9562"
url: "https://localhost:3000/catalogue/components/uuid-generator"
---

# UUID generator

Library UUID generation on each node; random v4 by default.

| | |
|---|---|
| Provider | [default](https://localhost:3000/catalogue?provider=default) |
| Kind | [ID generator](https://localhost:3000/catalogue/kinds/id-generator) |
| Category | Data |
| Official docs | [https://datatracker.ietf.org/doc/html/rfc9562](https://datatracker.ietf.org/doc/html/rfc9562) |

## Properties

| property | type | values | required | kind default | this component |
|---|---|---|---|---|---|
| `batchSize` | integer | — | no | — | inherited |
| `central` | boolean | — | no | false | **false** |
| `clockRollbackGuard` (advanced) | boolean | — | no | false | **false** |
| `managed` | boolean | — | no | false | inherited |
| `replicated` | boolean | — | no | false | **false** |
| `strategy` | enum | `uuid`, `ulid`, `snowflake`, `counter`, `counter-batched`, `hash` | yes | — | **"uuid"** |
| `timeSortable` | boolean | — | no | false | **false** |
| `uuidVersion` | enum | `v1`, `v4`, `v7` | no | "v4" | inherited |

Bold values are the ones this component pins.

## Rules that apply · 0

No rule selects this kind or its category.

## Other products of the same kind · 4

- [Generic ID generator](https://localhost:3000/catalogue/components/id-generator.md) `id-generator` — default
- [Snowflake ID](https://localhost:3000/catalogue/components/snowflake-id.md) `snowflake-id` — default
- [Ticket server](https://localhost:3000/catalogue/components/ticket-server.md) `ticket-server` — default
- [ULID service](https://localhost:3000/catalogue/components/ulid-service.md) `ulid-service` — default

## Use it in a design

```yaml
nodes:
  - { id: "uuid-generator", component: "uuid-generator" }
```

## Source (`component` YAML, verbatim)

```yaml
# yaml-language-server: $schema=../../schema/component.schema.json
# Library UUID generation on each node; random v4 by default, v7 adds time ordering.
schemaVersion: "1"
type: "component"
id: "uuid-generator"
kind: "id-generator"
provider: "default"
docs: "https://datatracker.ietf.org/doc/html/rfc9562"
defaults:
  strategy: "uuid"
  central: false
  replicated: false
  timeSortable: false
  clockRollbackGuard: false
properties:
  uuidVersion:
    type: "enum"
    values: ["v1", "v4", "v7"]
    default: "v4"
```

Human page: https://localhost:3000/catalogue/components/uuid-generator
