nanoid

The Nim implementation of NanoID

Pure Nim score 30/100 · tests present · docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install nanoid
choosenim install nanoid
git clone https://github.com/icyphox/nanoid.nim

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
nanoid - - - - - - -

Source

Repository https://github.com/icyphox/nanoid.nim
Homepage https://github.com/icyphox/nanoid.nim
Documentation View Documentation
Registry Source nimble_official

README

nanoid.nim

the Nim implementation of NanoID

Build Status

What even?

NanoID is a tiny, secure URL-friendly unique string ID generator.
It's safe. It uses cryptographically strong random APIs that guarantees proper distribution of symbols.
And it's compact. It uses a larger alphabet than the standard UUID (A-Za-z0-9_-), and has a similar number of unique IDs in just 21 symbols instead of 36.

Installation

nimble install nanoid

Optionally, run the test suite (after cloning this repo) using

nimble test

Usage

Simple

Uses the default alphabet set (A-Za-z0-9_-) and a size of 21 symbols.

import nanoid

echo generate()  # RKF2A0-pGhJfpm6-rSi5C

Non-secure

import nanoid

echo generateNonSecure()  # SL8Zh8Lfw9TIRbaQI-DxB

Custom alphabet/size

import nanoid

let
  a = "abcdef12345"
  s = 10

echo generate(alphabet=a, size=10)  # 15aa1d2b3a

That’s it, really.

TODO

  • [ ] Async API

Contributing

Bad code? New feature in mind? Open an issue. Better still, learn Nim and shoot a PR :sparkles:

License

MIT © Anirudh Oppiliappan