New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

idmint

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idmint

Enterprise-grade, collision-resistant unique ID generator

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

idmint

npm npm license

Simple, secure, and scalable unique ID generator for modern applications

idmint is a lightweight, TypeScript-friendly unique ID generator designed for high-traffic frontend and backend applications.
It uses cryptographically secure randomness to generate collision-resistant IDs without any database, server coordination, or external dependency.

❤️ Why idmint?

  • Most ID libraries silently accept invalid input.
  • In production systems, silent bugs are worse than crashes.
  • idmint fails fast, fails clearly, and fails safely.

idmint focuses on clarity, flexibility, and enterprise readiness while remaining lightweight and easy to use.

✨ Features

  • 🔐 Cryptographically secure IDs (Node.js crypto)
  • Extremely low collision probability (safe for millions to billions of IDs)
  • 🧩 Optional size parameter (flexible length)
  • 🕒 Time-based sortable IDs
  • 🏷 Prefix support
  • 📦 Zero runtime dependencies
  • 🟦 Written in TypeScript
  • 🚀 Works in high-traffic & distributed systems

📦 Installation

npm install idmint

🚀 Usage

Generate a default ID

import { generateId } from "idmint";

const id = generateId();
console.log(id);
// → "V1StGXR8_Z5jdHi6B-myT"

Generate ID with custom size

generateId(7);    // shorter ID
generateId(32);   // longer, ultra-safe ID

ℹ️ Allowed size range: 4 to 64

Generate ID with prefix

import { generateIdWithPrefix } from "idmint";

const id = generateIdWithPrefix("user", 10);
console.log(id);
// → "user_K9dLx2PqA"

Useful for:

  • User IDs
  • Order IDs
  • Entity-based identifiers

Generate time-based sortable ID

import { timeBasedId } from "idmint";

const id = timeBasedId();
console.log(id);
// → "lq9z3a8c4kH9dP2"

These IDs naturally sort by creation time, which is useful for:

  • Logs
  • Tables
  • Pagination
  • Short URLs
  • Analytics & tracking

Preset generators

import { idmint } from "idmint";

idmint.short();    // 8 characters
idmint.medium();   // 21 characters (default, recommended)
idmint.long();     // 32 characters

🚫 Error handling

All public APIs validate input and throw descriptive errors. This is intentional to avoid silent failures in production.

🔒 How uniqueness is ensured

idmint does not store IDs in any database.

Uniqueness is achieved through:

  • Cryptographically secure random bytes
  • High-entropy alphabet (64 URL-safe characters)
  • Configurable ID length

Collision probability

With default settings:

  • Alphabet size: 64
  • Length: 21 characters
  • Entropy: 126 bits

This makes collision probability astronomically low, even with millions or billions of generated IDs.

🧠 When to use idmint

  • React keys
  • Short URLs
  • Client-side ID generation
  • Temporary IDs before database insert
  • Logs & request tracking
  • Distributed systems (no coordination required)

📄 License

MIT

Keywords

unique-id

FAQs

Package last updated on 01 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts