UUID Use Case

UUID Placeholder ID

Sometimes you need an id before the row is created — a draft, a preview, a template. A UUID placeholder fills the gap.

Pre-entitySchema-validv4

Generated locally with the Web Crypto API — nothing leaves your browser.

What Is UUID Placeholder ID?

How to generate

  1. Generate a v4 UUID when creating a draft.
  2. Use it as the temporary id in the UI.
  3. Replace with the persisted id on save.

Use Cases

Code Examples

JavaScript
const id = crypto.randomUUID();
Python
import uuid
id = uuid.uuid4()

Frequently Asked Questions

Keep the placeholder after save?
No — swap it for the real, persisted id; the placeholder was only to keep the shape valid.
Why not a sentinel like -1?
Sentinels break 'id is a valid UUID' assumptions and can collide in maps.

Related tools