API reference@evolu/commonType › createIdAsUuidv7

function createIdAsUuidv7<B>(
  deps: RandomBytesDep & TimeDep,
): [B] extends [never] ? string & Brand<"Id"> : string & Brand<"Id"> & Brand<B>;

Defined in: packages/common/src/Type.ts:1835

Creates an Id embedding timestamp bits (UUID v7 layout) before Base64Url encoding.

Tradeoff: better insertion locality / index performance for huge datasets vs leaking creation time everywhere the Id appears. Evolu uses createId by default to avoid activity leakage; choose this only if you explicitly accept timestamp exposure.

Example

const id = createIdAsUuidv7({ randomBytes, time });
const todoId = createIdAsUuidv7<"Todo">({ randomBytes, time });