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

@eristack/doc-number

v0.3.2

Published

Document number format, parse, and sequence primitives for Eristack

Readme

@eristack/doc-number

Document number format, parse, and sequence primitives for ERP-style apps.

  • Token patterns: {YYYY}, {YY}, {MM}, {DD}, {SEQ} / {SEQ:n}
  • Reset periods: never | yearly | monthly | daily
  • Optional FormatStore + SequenceStore (memory + Drizzle)
  • Optional custom incrementer
  • Headless format-config adapters: REST / Express / Nest / client / React

Install

pnpm add @eristack/doc-number
# optional peers depending on entry:
# drizzle-orm | express | @nestjs/common @nestjs/core | react

Export map

| Import | Purpose | | --- | --- | | @eristack/doc-number | Format / parse / createDocNumber + memory stores | | @eristack/doc-number/drizzle | Format + sequence tables and stores | | @eristack/doc-number/rest | Headless format CRUD + preview actions | | @eristack/doc-number/express | Express router for format configuration | | @eristack/doc-number/nest | Nest module + controller | | @eristack/doc-number/client | Headless frontend client | | @eristack/doc-number/react | Headless React provider/hooks (no UI) |

Quick start

import {
  createDocNumber,
  createMemoryFormatStore,
  createMemorySequenceStore,
  formatDocumentNumber,
} from "@eristack/doc-number";

formatDocumentNumber({
  pattern: "INV-{YYYY}{MM}-{SEQ:5}",
  sequence: 42,
  at: new Date("2026-08-11T00:00:00.000Z"),
});
// → "INV-202608-00042"

const docNumber = createDocNumber({
  formats: createMemoryFormatStore(),
  sequences: createMemorySequenceStore(),
});

await docNumber.registerFormat({
  entityKey: "invoice",
  pattern: "INV-{YYYY}{MM}-{SEQ:5}",
  reset: "monthly",
});

const next = await docNumber.next({ entityKey: "invoice" });

Format configuration (Express)

import { createDocNumberRouter } from "@eristack/doc-number/express";

app.use("/doc-number", requireAdmin, createDocNumberRouter({ docNumber }));

Mount behind your own auth. React settings screens use @eristack/doc-number/react (useDocNumberFormats) — you own the form UI.

Docs

Package docs are the source of truth; the site renders them at /docs/doc-number.

| Page | Covers | | --- | --- | | Introduction | Problem, layers, allocation vs format configuration, injection rule | | Getting started | Pure format → memory stores → peek → Drizzle | | Concepts | entityKey, active formats, period buckets, prefix, clock, allocators | | Format DSL | Tokens, validation rules, parse semantics, UTC | | Sequencing | Reset → period key, next vs peekNext, backfills, concurrency | | Formats & listing | register / update / read, listFormats, formatDataGridSchema | | Stores & Drizzle | Store interfaces, tables, dialects, row locking | | HTTP & UI adapters | REST bodies, Express, Nest, client, React hooks + Form | | Recipes | Monthly invoices, tenants, Redis incrementer, settings screen | | API reference | Every export by entry point |

Intent skills

pnpm dlx @tanstack/intent@latest load @eristack/doc-number#doc-number-core
pnpm dlx @tanstack/intent@latest load @eristack/doc-number#doc-number-adapters