yoursuuid
v1.0.0
Published
Zero-dependency UUID v4/v5/v7, ULID and NanoID generator, plus JWT, bcrypt, JSON converters and a CLI and MCP server
Maintainers
Readme
yoursuuid
Zero-dependency UUID v4 / v5 / v7, ULID and NanoID generation, validation and decoding for browsers, Node 20+, Deno, Bun and edge runtimes. Ships a CLI and an MCP server. MIT licensed.
Randomness comes only from crypto.getRandomValues. UUID v7 and ULID are monotonic within a process, so IDs created
in the same millisecond still sort in creation order.
Install
npm install yoursuuidLibrary
import { uuidv4, uuidv7, uuidv5, ulid, nanoid, parseUuid, isUuid } from 'yoursuuid'
uuidv7() // '0192d3a1-7c4f-7b2a-9d1e-3f5a6b7c8d9e'
uuidv4() // random v4
await uuidv5('example.com', 'dns') // deterministic, SHA-1 name-based
ulid() // '01JB8S3Y2F7Q9X4M5N6P7R8S9T'
nanoid(12) // 'V1StGXR8_Z5j'
parseUuid('0192d3a1-7c4f-7b2a-9d1e-3f5a6b7c8d9e')
// { valid: true, uuid: '…', version: 7, variant: 'rfc9562', timestamp: Date(2024-10-28T14:57:08.687Z) }
isUuid('{0192D3A1-7C4F-7B2A-9D1E-3F5A6B7C8D9E}') // true — braces, urn:uuid: and missing hyphens are acceptedDeveloper utilities (yoursuuid/devtools)
import { hmac, jsonToTypescript, jsonToZod, describeCron, cronNextRuns, jwtSign, bcryptHash } from 'yoursuuid/devtools'
await hmac('SHA-256', 'secret', 'message') // hex; also 'base64' and 'base64url'
jsonToTypescript('{"id":1,"tags":["a"]}', { rootName: 'User' })
jsonToZod('{"id":1}', { rootName: 'User' })
describeCron('0 9 * * 1-5') // 'At 09:00 on Monday through Friday'
cronNextRuns('*/15 * * * *', { count: 3, utc: true }) // [Date, Date, Date]
await jwtSign({ sub: 'a' }, 'secret', 'HS256')
bcryptHash('password', 10)Cron follows standard 5-field Vixie semantics: names (JAN, MON), ranges, steps, lists, 7 = Sunday,
@daily-style macros, and "day of month OR day of week" when both are restricted.
CLI
npx yoursuuid # one UUID v4
npx yoursuuid v7 -n 5 # five UUID v7
npx yoursuuid ulid -n 3
npx yoursuuid nanoid --size 12
npx yoursuuid v5 example.com --namespace dns
npx yoursuuid inspect 0192d3a1-7c4f-7b2a-9d1e-3f5a6b7c8d9e
npx yoursuuid hmac "message" --key secret --alg sha256
npx yoursuuid jwt sign '{"sub":"a"}' --secret secret
npx yoursuuid bcrypt hash "password" --cost 10
npx yoursuuid cron "*/15 9-17 * * 1-5" --utc
npx yoursuuid cron build --minute 0 --hour 9 --dow 1-5
curl -s https://api.github.com/users/octocat | npx yoursuuid json2ts --name User
npx yoursuuid json2zod payload.json --name User
npx yoursuuid chmod 755
npx yoursuuid compose "docker run -d -p 8080:80 nginx"Flags: --upper, --no-hyphens.
MCP server
Lets AI assistants (Claude, Cursor, VS Code, Windsurf…) generate and inspect identifiers locally.
{
"mcpServers": {
"yoursuuid": { "command": "npx", "args": ["-y", "yoursuuid", "mcp"] }
}
}Tools: generate_uuid, generate_uuid_v5, generate_ulid, generate_nanoid, inspect_uuid, hmac,
jwt_sign, jwt_verify, bcrypt_hash, bcrypt_verify, base58, base32, json_to_typescript,
json_to_zod, json_to_go, json_to_rust, format_sql, curl_to_code, cron_next_runs, build_cron,
explain_regex, explain_chmod, docker_run_to_compose.
No install? The hosted Streamable HTTP endpoint https://yoursuuid.com/mcp offers the identifier tools. HMAC, JWT
and bcrypt stay on the local server so secrets never leave your machine.
Why v7?
UUID v7 puts a millisecond timestamp first, so database indexes receive keys in order instead of at random pages. See the UUID v7 visualizer and the collision calculator.
License
MIT
