npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

idkit.js

v1.0.0

Published

A tiny, secure, zero-dependency ID and randomness toolkit for Node.js and browsers.

Readme

idkit.js / I don't know it dot javascript

Tiny, secure, zero-dependency ID and randomness toolkit for Node.js and browsers.

Generate tokens, short IDs, invite codes, human-readable IDs, time-sortable IDs, and a few other things you probably didn’t know you needed until now.

Yes, you could write your own random ID generator in 6 lines.
Yes, it will probably break in production.

idkit.js exists so you don't have to find out the hard way.

npm version bundle size license TypeScript


Install

npm install idkit.js
# or
pnpm add idkit.js
# or
yarn add idkit.js

10-Second Example

import { humanId, inviteCode, shortId, timeId, token } from "idkit.js";

token(32);
// "f8a29c4d7f3a9e1b8c1d2a3b4e5f6a7b"

shortId(8);
// "f9K3aP2L"

humanId();
// "blue-tiger-4821"

inviteCode(6);
// "K7M4XP"

timeId();
// "01HF6K2A9P8J5TQXR4NW"

If this already solves your problem, you can stop reading and go ship something.


Features

  • 🔐 Secure by default — uses crypto.randomBytes (Node) / crypto.getRandomValues (browser)
  • 🌲 Tree-shakable — import only what you need
  • 📦 Zero dependencies — your dependency graph will thank you
  • 🟦 TypeScript-first — types included
  • Node + Browser support
  • 🎛️ 13 utilities — tokens, IDs, invite codes, randomness helpers

Quick Examples

Generate a Token

import { token } from "idkit.js";

token(32);

Output:

f8a29c4d7f3a9e1b8c1d2a3b4e5f6a7b

Perfect for:

  • API keys
  • password reset tokens
  • session IDs

Short IDs

import { shortId } from "idkit.js";

shortId(8);

Example:

f9K3aP2L

URL-safe version (includes - and _):

shortId(10, { urlSafe: true });

Example:

aB-_3kZ9mQ

Human-Readable IDs

import { humanId } from "idkit.js";

humanId();

Example:

blue-tiger-4821
solar-fox-1093
silent-ocean-8822

Good for:

  • user-visible IDs
  • invite systems
  • debugging

Invite Codes

import { inviteCode } from "idkit.js";

inviteCode(6);

Example:

K7M4XP

Grouped codes:

inviteCode(12, { group: 4 });

Example:

K7M4-XP9Q-R2TW

Characters like 0, O, I, 1, l are removed to avoid confusion.


Time-Sortable IDs

import { timeId } from "idkit.js";

timeId();

Example:

01HF6K2A9P8J5TQXR4NW7DM3Z2

Properties:

  • sortable by creation time
  • globally unique
  • URL safe

Great for:

  • database primary keys
  • event logs
  • distributed systems

Pattern-Based IDs

import { pattern } from "idkit.js";

pattern("INV-####");
pattern("USER-AAAA-####");

Examples:

INV-4821
USER-XKQW-3921

Pattern symbols:

| Symbol | Meaning | | ------ | ---------------- | | # | random digit | | A | uppercase letter | | a | lowercase letter | | * | alphanumeric |


Random Utilities

Random Integer

import { randomInt } from "idkit.js";

randomInt(1, 100);

Random Float

import { randomFloat } from "idkit.js";

randomFloat();

Shuffle Array

import { shuffle } from "idkit.js";

shuffle([1, 2, 3, 4]);

Pick Random Element

import { pick } from "idkit.js";

pick(["apple", "banana", "cherry"]);

Collision-Safe IDs

import { shortId, uniqueId } from "idkit.js";

const ids = new Set();

const id = uniqueId(() => shortId(6), ids);

Ensures no duplicates exist in your dataset.


Seeded Random Generator

For deterministic testing:

import { seeded } from "idkit.js";

const rng = seeded("test-seed");

rng.shortId(8);
rng.randomInt(1, 100);

Same seed → same results.

Not for security use.


Collision Probability Calculator

import { collisionProbability } from "idkit.js";

collisionProbability({
  alphabet: 62,
  length: 8,
  samples: 1_000_000,
});

Useful for estimating ID collision risk.


Why Not Math.random()?

Math.random() is not cryptographically secure.

It’s fine for:

  • games
  • visual randomness
  • simulations

It is not fine for:

  • tokens
  • invite codes
  • authentication

idkit.js uses cryptographically secure randomness instead.


Choosing the Right Function

| Use Case | Function | | ----------------- | -------------- | | API tokens | token() | | Short IDs | shortId() | | User-friendly IDs | humanId() | | Invite systems | inviteCode() | | Database keys | timeId() | | Custom formats | pattern() |


Tree-Shakable Imports

Import everything:

import { token } from "idkit.js";

Or import individual modules:

import token from "idkit.js/token";

Your bundler will only include what you use.


License

MIT

Use it, modify it, ship it.