Skip to content
Myr

README.md

This file

Path

README.md

425 lines · 12.9 KiB · Markdown

Last changed by

landed by oscabrielc0d01e3

History of this file

Take it

The walk stopped after 200 commits: lines older than cdc3edc point at it.

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 1–5why, one step back
1# Nano ID
23<img src="https://ai.github.io/nanoid/logo.svg" align="right"4 alt="Nano ID logo by Anton Lovchikov" width="180" height="94">5

docs: add Arabic README translation (#556)Mahmoud Hamdybefore adoptiondc629c5

line 6why, one step back
6**English** | [日本語](./README.ja.md) | [Русский](./README.ru.md) | [简体中文](./README.zh-CN.md) | [Bahasa Indonesia](./README.id-ID.md) | [한국어](./README.ko.md) | [العربية](./README.ar.md)

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 7–12why, one step back
7
8A tiny, secure, URL-friendly, unique string ID generator for JavaScript.910> “An amazing level of senseless perfectionism,11> which is simply impossible not to respect.”12

Reduce Nano ID size to 117 bytes (#613)Alexander Bayandinbefore adoption05057d8

line 13why, one step back
13- **Small.** 117 bytes (minified and brotlied). No dependencies.

Update size limitAndrey Sitnikbefore adoptioncdc3edc

line 14why, one step back
14 [Size Limit] controls the size.

Port amazing nope-id optimizations (#602)Andrey Sitnikbefore adoptionb1bb75f

line 15why, one step back
15- **Fast.** 50% faster than native `crypto.randomUUID()`.

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

lines 16–17why, one step back
16- **Safe.** It uses hardware random generator. Can be used in clusters.
17- **Short IDs.** It uses a larger alphabet than UUID (`A-Za-z0-9_-`).

Update size limitAndrey Sitnikbefore adoptioncdc3edc

line 18why, one step back
18 So ID size was reduced from 36 to 21 symbols.

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

line 19why, one step back
19- **Portable.** Nano ID was ported

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 20–22why, one step back
20 to over [20 programming languages](./README.md#other-programming-languages).
2122```js

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

lines 23–24why, one step back
23import { nanoid } from "nanoid";
24model.id = nanoid(); //=> "V1StGXR8_Z5jdHi6B-myT"

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 25–28why, one step back
25```
2627---28

Update EM bannerAndrey Sitnikbefore adoptionb49a237

line 29why, one step back
29<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" />  Nano ID is built by <b><a href="https://evilmartians.com/">Evil Martians</a></b>, an American design and engineering consultancy for <b>developer tools, AI, and cybersecurity startups</b>.

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 30–32why, one step back
30
31---32

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

line 33why, one step back
33[Size Limit]: https://github.com/ai/size-limit

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 34–41why, one step back
34
35## Table of Contents3637- [Table of Contents](#table-of-contents)38- [Comparison with UUID](#comparison-with-uuid)39- [Benchmark](#benchmark)40- [Security](#security)41- [Install](#install)

Clean up docsAndrey Sitnikbefore adoption90bb934

line 42why, one step back
42 - [CDN](#cdn)

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 43–45why, one step back
43- [API](#api)
44 - [Custom Alphabet or Size](#custom-alphabet-or-size)45 - [Custom Random Bytes Generator](#custom-random-bytes-generator)

Update docsAndrey Sitnikbefore adoptionc0779bd

line 46why, one step back
46 - [Non-Secure](#non-secure)

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 47–51why, one step back
47- [Usage](#usage)
48 - [React](#react)49 - [React Native](#react-native)50 - [PouchDB and CouchDB](#pouchdb-and-couchdb)51 - [CLI](#cli)

Clean up docsAndrey Sitnikbefore adoptionf7862cb

line 52why, one step back
52 - [TypeScript](#typescript)

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 53–68why, one step back
53 - [Other Programming Languages](#other-programming-languages)
54- [Tools](#tools)5556## Comparison with UUID5758Nano ID is quite comparable to UUID v4 (random-based).59It has a similar number of random bits in the ID60(126 in Nano ID and 122 in UUID), so it has a similar collision probability:6162> For there to be a one in a billion chance of duplication,63> 103 trillion version 4 IDs must be generated.6465There are two main differences between Nano ID and UUID v4:66671. Nano ID uses a bigger alphabet, so a similar number of random bits68 are packed in just 21 symbols instead of 36.

Port amazing nope-id optimizations (#602)Andrey Sitnikbefore adoptionb1bb75f

line 69why, one step back
692. Nano ID is faster than `crypto.randomUUID` and `uuid/v4`.

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 70–74why, one step back
70
71## Benchmark7273```rust74$ node ./test/benchmark.js

Port amazing nope-id optimizations (#602)Andrey Sitnikbefore adoptionb1bb75f

lines 75–85why, one step back
75nope-id 20,386,830 ops/sec
76nanoid 20,434,827 ops/sec77customAlphabet 20,544,476 ops/sec78crypto.randomUUID 12,865,759 ops/sec79uuid v4 7,930,104 ops/sec80@napi-rs/uuid 5,573,171 ops/sec81uid/secure 6,308,267 ops/sec82@lukeed/uuid 5,278,597 ops/sec83nanoid for browser 311,497 ops/sec84secure-random-string 301,667 ops/sec85uid-safe.sync 297,815 ops/sec

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 86–87why, one step back
86
87Non-secure:

Port amazing nope-id optimizations (#602)Andrey Sitnikbefore adoptionb1bb75f

lines 88–90why, one step back
88uid 20,286,757 ops/sec
89nanoid/non-secure 2,397,594 ops/sec90rndm 2,445,462 ops/sec

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 91–94why, one step back
91```
9293## Security94

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

lines 95–96why, one step back
95_See a good article about random generators theory:
96[Secure random values (in Node.js)]_

Update size limitAndrey Sitnikbefore adoptioncdc3edc

line 97why, one step back
97

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

line 98why, one step back
98- **Unpredictability.** Instead of using the unsafe `Math.random()`, Nano ID

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 99–100why, one step back
99 uses the `crypto` module in Node.js and the Web Crypto API in browsers.
100 These modules use unpredictable hardware random generator.

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

line 101why, one step back
101- **Uniformity.** `random % alphabet` is a popular mistake to make when coding

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 102–109why, one step back
102 an ID generator. The distribution will not be even; there will be a lower
103 chance for some symbols to appear compared to others. So, it will reduce104 the number of tries when brute-forcing. Nano ID uses a [better algorithm]105 and is tested for uniformity.106107 <img src="img/distribution.png" alt="Nano ID uniformity"108 width="340" height="135">109

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

line 110why, one step back
110- **Well-documented:** all Nano ID hacks are documented. See comments

Update size limitAndrey Sitnikbefore adoptioncdc3edc

line 111why, one step back
111 in [the source].

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

line 112why, one step back
112- **Vulnerabilities:** to report a security vulnerability, please use

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 113–116why, one step back
113 the [Tidelift security contact](https://tidelift.com/security).
114 Tidelift will coordinate the fix and disclosure.115116[Secure random values (in Node.js)]: https://gist.github.com/joepie91/7105003c3b26e65efcea63f3db82dfba

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

lines 117–118why, one step back
117[better algorithm]: https://github.com/ai/nanoid/blob/main/index.js
118[the source]: https://github.com/ai/nanoid/blob/main/index.js

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 119–121why, one step back
119
120## Install121

Clean up docsAndrey Sitnikbefore adoption90bb934

lines 122–123why, one step back
122```bash
123npm install nanoid

Update size limitAndrey Sitnikbefore adoptioncdc3edc

line 124why, one step back
124```

Add JSR docsAndrey Sitnikbefore adoption6ed8f57

line 125why, one step back
125

Clean up docsAndrey Sitnikbefore adoption90bb934

lines 126–131why, one step back
126### CDN
127128For quick hacks, you can load Nano ID from CDN. Though, it is not recommended129to be used in production because of the lower loading performance.130131```js

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

line 132why, one step back
132import { nanoid } from "https://cdn.jsdelivr.net/npm/nanoid/nanoid.js";

Clean up docsAndrey Sitnikbefore adoption90bb934

line 133why, one step back
133```

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 134–140why, one step back
134
135## API136137By default, Nano ID uses URL-friendly symbols (`A-Za-z0-9_-`) and returns an ID138with 21 characters (to have a collision probability similar to UUID v4).139140```js

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

lines 141–142why, one step back
141import { nanoid } from "nanoid";
142model.id = nanoid(); //=> "V1StGXR8_Z5jdHi6B-myT"

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 143–148why, one step back
143```
144145If you want to reduce the ID size (and increase collisions probability),146you can pass the size as an argument.147148```js

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

line 149why, one step back
149nanoid(10); //=> "IRFa-VaY2b"

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 150–165why, one step back
150```
151152Don’t forget to check the safety of your ID size153in our [ID collision probability] calculator.154155You can also use a [custom alphabet](#custom-alphabet-or-size)156or a [random generator](#custom-random-bytes-generator).157158[ID collision probability]: https://zelark.github.io/nano-id-cc/159160### Custom Alphabet or Size161162`customAlphabet` returns a function that allows you to create `nanoid`163with your own alphabet and ID size.164165```js

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

lines 166–168why, one step back
166import { customAlphabet } from "nanoid";
167const nanoid = customAlphabet("1234567890abcdef", 10);168model.id = nanoid(); //=> "4f90d13a42"

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 169–171why, one step back
169```
170171```js

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

lines 172–174why, one step back
172import { customAlphabet } from "nanoid/non-secure";
173const nanoid = customAlphabet("1234567890abcdef", 10);174user.id = nanoid();

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 175–180why, one step back
175```
176177Check the safety of your custom alphabet and ID size in our178[ID collision probability] calculator. For more alphabets, check out the options179in [`nanoid-dictionary`].180

Document the alphabet bounds instead of guarding them at runtime (#609)Jeff Lenamonbefore adoption8588e3a

lines 181–184why, one step back
181Alphabet must contain from 1 to 256 symbols.
182Otherwise, the security of the internal generator algorithm is not guaranteed,183and a generator built from an empty or over-256-symbol alphabet184can loop forever instead of returning an ID.

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 185–189why, one step back
185
186In addition to setting a default size, you can change the ID size when calling187the function:188189```js

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

lines 190–192why, one step back
190import { customAlphabet } from "nanoid";
191const nanoid = customAlphabet("1234567890abcdef", 10);192model.id = nanoid(5); //=> "f01a2"

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 193–194why, one step back
193```
194

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

line 195why, one step back
195[`nanoid-dictionary`]: https://github.com/CyberAP/nanoid-dictionary

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 196–204why, one step back
196
197### Custom Random Bytes Generator198199`customRandom` allows you to create a `nanoid` and replace alphabet200and the default random bytes generator.201202In this example, a seed-based generator is used:203204```js

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

line 205why, one step back
205import { customRandom } from "nanoid";

Update size limitAndrey Sitnikbefore adoptioncdc3edc

line 206why, one step back
206

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

lines 207–210why, one step back
207const rng = seedrandom(seed);
208const nanoid = customRandom("abcdef", 10, (size) => {209 return new Uint8Array(size).map(() => 256 * rng());210});

Update size limitAndrey Sitnikbefore adoptioncdc3edc

line 211why, one step back
211

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

line 212why, one step back
212nanoid(); //=> "fbaefaadeb"

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 213–221why, one step back
213```
214215`random` callback must accept the array size and return an array216with random numbers.217218If you want to use the same URL-friendly symbols with `customRandom`,219you can get the default alphabet using the `urlAlphabet`.220221```js

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

lines 222–223why, one step back
222import { customRandom, urlAlphabet } from "nanoid";
223const nanoid = customRandom(urlAlphabet, 10, random);

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 224–228why, one step back
224```
225226Note, that between Nano ID versions we may change random generator227call sequence. If you are using seed-based generators, we do not guarantee228the same result.

Update docsAndrey Sitnikbefore adoptionc0779bd

lines 229–236why, one step back
229
230### Non-Secure231232Nano ID uses hardware random bytes generation for security and low collision233probability. If you are not so concerned with security, you can use it234for environments without hardware random generators.235236```js

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

lines 237–238why, one step back
237import { nanoid } from "nanoid/non-secure";
238const id = nanoid(); //=> "Uakgb_J5m9g-0JDMbcJqLJ"

Update docsAndrey Sitnikbefore adoptionc0779bd

lines 239–242why, one step back
239```
240241Note, that non-secure version is _slower_ than secure.242Use it only if you have to.

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 243–251why, one step back
243
244## Usage245246### React247248There’s no correct way to use Nano ID for React `key` prop249since it should be consistent among renders.250251```jsx

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

line 252why, one step back
252function Todos({ todos }) {

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 253–254why, one step back
253 return (
254 <ul>

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

line 255why, one step back
255 {todos.map((todo) => (

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

line 256why, one step back
256 <li key={nanoid()}>

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

line 257why, one step back
257 {" "}

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

line 258why, one step back
258 /* DON’T DO IT */

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 259–262why, one step back
259 {todo.text}
260 </li>261 ))}262 </ul>

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

line 263why, one step back
263 );

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 264–269why, one step back
264}
265```266267You should rather try to reach for stable ID inside your list item.268269```jsx

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

line 270why, one step back
270const todoItems = todos.map((todo) => <li key={todo.id}>{todo.text}</li>);

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 271–276why, one step back
271```
272273In case you don’t have stable IDs you'd rather use index as `key`274instead of `nanoid()`:275276```jsx

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

lines 277–278why, one step back
277const todoItems = todos.map((text, index) => (
278 <li key={index}>

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

lines 279–281why, one step back
279 {" "}
280 /* Still not recommended but preferred over nanoid(). Only do this if items have no stable IDs.281 */

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 282–283why, one step back
282 {text}
283 </li>

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

line 284why, one step back
284));

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 285–290why, one step back
285```
286287In case you just need random IDs to link elements like labels288and input fields together, [`useId`] is recommended.289That hook was added in React 18.290

Fix outdated info and links in README (#566)Mahmoud Hamdybefore adoptionc7ca9e9

line 291why, one step back
291[`useId`]: https://react.dev/reference/react/useId

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 292–301why, one step back
292
293### React Native294295React Native does not have built-in random generator. The following polyfill296works for plain React Native and Expo starting with `39.x`.2972981. Check [`react-native-get-random-values`] docs and install it.2992. Import it before Nano ID.300301```js

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

lines 302–303why, one step back
302import "react-native-get-random-values";
303import { nanoid } from "nanoid";

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 304–348why, one step back
304```
305306[`react-native-get-random-values`]: https://github.com/LinusU/react-native-get-random-values307308### PouchDB and CouchDB309310In PouchDB and CouchDB, IDs can’t start with an underscore `_`.311A prefix is required to prevent this issue, as Nano ID might use a `_`312at the start of the ID by default.313314Override the default ID with the following option:315316```js317db.put({318 _id: 'id' + nanoid(),319 …320})321```322323### CLI324325You can get unique ID in terminal by calling `npx nanoid`. You need only326Node.js in the system. You do not need Nano ID to be installed anywhere.327328```sh329$ npx nanoid330npx: installed 1 in 0.63s331LZfXLFzPPR4NNrgjlWDxn332```333334Size of generated ID can be specified with `--size` (or `-s`) option:335336```sh337$ npx nanoid --size 10338L3til0JS4z339```340341Custom alphabet can be specified with `--alphabet` (or `-a`) option342(note that in this case `--size` is required):343344```sh345$ npx nanoid --alphabet abc --size 15346bccbcabaabaccab347```348

Make functions generic so it can cast to opaque (branded) types (#521)Sasha Kossbefore adoptionea64dc7

lines 349–354why, one step back
349### TypeScript
350351Nano ID allows casting generated strings into opaque strings in TypeScript.352For example:353354```ts

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

lines 355–356why, one step back
355declare const userIdBrand: unique symbol;
356type UserId = string & { [userIdBrand]: true };

Make functions generic so it can cast to opaque (branded) types (#521)Sasha Kossbefore adoptionea64dc7

line 357why, one step back
357

Clean up docsAndrey Sitnikbefore adoptionf7862cb

line 358why, one step back
358// Use explicit type parameter:

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

line 359why, one step back
359mockUser(nanoid<UserId>());

Clean up docsAndrey Sitnikbefore adoptionf7862cb

line 360why, one step back
360

Make functions generic so it can cast to opaque (branded) types (#521)Sasha Kossbefore adoptionea64dc7

line 361why, one step back
361interface User {

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

lines 362–363why, one step back
362 id: UserId;
363 name: string;

Make functions generic so it can cast to opaque (branded) types (#521)Sasha Kossbefore adoptionea64dc7

lines 364–368why, one step back
364}
365366const user: User = {367 // Automatically casts to UserId:368 id: nanoid(),

Reduce dependencies by moving to Rolldown instead of Webpack for Size LimitAndrey Sitnikbefore adoptionb8918c5

lines 369–370why, one step back
369 name: "Alice",
370};

Make functions generic so it can cast to opaque (branded) types (#521)Sasha Kossbefore adoptionea64dc7

line 371why, one step back
371```

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 372–377why, one step back
372
373### Other Programming Languages374375Nano ID was ported to many languages. You can use these ports to have376the same ID generator on the client and server side.377

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

lines 378–398why, one step back
378- [C](https://github.com/lukateras/nanoid.h)
379- [C#](https://github.com/codeyu/nanoid-net)380- [C++](https://github.com/mcmikecreations/nanoid_cpp)381- [Clojure and ClojureScript](https://github.com/zelark/nano-id)382- [ColdFusion/CFML](https://github.com/JamoCA/cfml-nanoid)383- [Crystal](https://github.com/mamantoha/nanoid.cr)384- [Dart & Flutter](https://github.com/pd4d10/nanoid-dart)385- [Elixir](https://github.com/railsmechanic/nanoid)386- [Gleam](https://github.com/0xca551e/glanoid)387- [Go](https://github.com/matoous/go-nanoid)388- [Haskell](https://github.com/MichelBoucey/NanoID)389- [Haxe](https://github.com/flashultra/uuid)390- [Janet](https://sr.ht/~statianzo/janet-nanoid/)391- [Java](https://github.com/wosherco/jnanoid-enhanced)392- [Kotlin](https://github.com/viascom/nanoid-kotlin)393- [MySQL/MariaDB](https://github.com/viascom/nanoid-mysql-mariadb)394- [Nim](https://github.com/icyphox/nanoid.nim)395- [OCaml](https://github.com/routineco/ocaml-nanoid)396- [Perl](https://github.com/tkzwtks/Nanoid-perl)397- [PHP](https://github.com/hidehalo/nanoid-php)398- Python [native](https://github.com/puyuan/py-nanoid) implementation

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 399–400why, one step back
399 with [dictionaries](https://pypi.org/project/nanoid-dictionary)
400 and [fast](https://github.com/oliverlambson/fastnanoid) implementation (written in Rust)

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

line 401why, one step back
401- Postgres [Extension](https://github.com/spa5k/uids-postgres)

Update size limitAndrey Sitnikbefore adoptioncdc3edc

line 402why, one step back
402 and [Native Function](https://github.com/viascom/nanoid-postgres)

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

lines 403–409why, one step back
403- [R](https://github.com/hrbrmstr/nanoid) (with dictionaries)
404- [Ruby](https://github.com/radeno/nanoid.rb)405- [Rust](https://github.com/nikolay-govorov/nanoid)406- [Swift](https://github.com/ShivaHuang/swift-nanoid)407- [Unison](https://share.unison-lang.org/latest/namespaces/hojberg/nanoid)408- [V](https://github.com/invipal/nanoid)409- [Zig](https://github.com/SasLuca/zig-nanoid)

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 410–416why, one step back
410
411For other environments, [CLI] is available to generate IDs from a command line.412413[CLI]: #cli414415## Tools416

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

line 417why, one step back
417- [ID size calculator] shows collision probability when adjusting

Update size limitAndrey Sitnikbefore adoptioncdc3edc

line 418why, one step back
418 the ID alphabet or size.

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

lines 419–420why, one step back
419- [`nanoid-dictionary`] with popular alphabets to use with [`customAlphabet`].
420- [`nanoid-good`] to be sure that your ID doesn’t contain any obscene words.

Update size limitAndrey Sitnikbefore adoptioncdc3edc

lines 421–422why, one step back
421
422[`nanoid-dictionary`]: https://github.com/CyberAP/nanoid-dictionary

Move from Prettier and ESLint to oxfmt and oxlintAndrey Sitnikbefore adoption4bf7b85

lines 423–425why, one step back
423[ID size calculator]: https://zelark.github.io/nano-id-cc/
424[`customAlphabet`]: #custom-alphabet-or-size425[`nanoid-good`]: https://github.com/y-gagar1n/nanoid-good