API reference › @evolu/common › Type › Id
const Id: brand(
"Id",
String,
(value) =>
value.length === 22 && Base64Url.from.parent(value).ok
? ok()
: err<IdError>({ type: "Id", value }),
(error) =>
The value ${safelyStringifyUnknownValue(error.value)} is not a valid Id.,
) ;
Defined in: packages/common/src/Type.ts:5892
Evolu Id: 16 bytes encoded as a 22-character Base64Url.
Like Nano ID, it is compact and URL-safe. Unlike Nano ID's 21-character default, an Evolu Id is the canonical Base64Url encoding of a full 128-bit value, so it round-trips directly between its string and byte representations with idToIdBytes and idBytesToId. These helpers use native Base64 APIs.
createId is the privacy-preserving default. Use createIdFromString for stable mappings from external identifiers, or createIdAsUuidv7 only when insertion locality is worth exposing the creation time encoded in the identifier.