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

@docufin/sdk

v0.0.2

Published

Docufin SDK is the workflow surface for building document pipelines.

Readme

Docufin SDK

Docufin SDK is the workflow surface for building document pipelines.

Install

bun add @docufin/sdk

Quick start

import { pipeline } from "@docufin/sdk/workflow";

export const OcrExtractReview = pipeline("ocr-extract-review", {
  concurrency: 2,
})
  .each(async (doc, { steps }) => {
    const text = await steps.ocr(doc);
    const schema = await steps.readSchema("invoice_schema");
    return await steps.extract(text, { schema });
  })
  .review({
    title: "Approve extraction",
    timeout: "72h",
  });

Concepts

  • Doc: A document reference (uri, optional mimeType, filename, meta).
  • Item<T>: A value paired with its source doc ({ doc, value }). .review() runs on items.
  • Streams: .each() starts with docs. Returning non-doc values switches the stream to items.

Pipeline DSL

  • .each(fn): Runs per doc. Return a Doc to keep a doc stream, or any other value to produce items.
  • .all(fn): Runs once on the full set. Return a Doc/Doc[] to keep docs, or a value to finish with a scalar.
  • .review(fn | config): Runs on items only. Pass a handler or a config with title/timeout.

Concurrency is applied only to .each() steps.

Steps API

Use steps inside handlers to access runtime integrations:

  • OCR and ML: steps.ocr, steps.classify, steps.extract, steps.llm
  • Schemas and prompts: steps.readSchema, steps.readPrompt
  • Review: steps.review
  • Artifacts: steps.readArtifact, steps.writeArtifact, steps.readText, steps.writeText, steps.readJson, steps.writeJson
  • Docs: steps.mergePdf, steps.writeTextAsDoc

Example artifact usage:

import { pipeline } from "@docufin/sdk/workflow";

export const ArtifactExample = pipeline("artifact-example").each(
  async (doc, { steps }) => {
    const text = await steps.readText(doc);

    const { uri } = await steps.writeText({
      text,
      filename: "raw.txt",
    });

    return await steps.readJson(uri);
  }
);

Params schema

Pass a schema with parse or safeParse to validate job params.

import { z } from "zod";
import { pipeline } from "@docufin/sdk/workflow";

const ParamsSchema = z.object({
  topic: z.string().optional(),
});

export const Haiku = pipeline("haiku", {
  schema: ParamsSchema,
}).all(async (_docs, { params, steps }) => {
  const haiku = await steps.llm(`Write a haiku about ${params.topic}.`);

  return await steps.writeTextAsDoc(`${haiku.trimEnd()}\n`, {
    filename: "haiku.txt",
    mimeType: "text/plain",
  });
});

Runtime rules

  • The runtime is the only source of durable tasks and waits.
  • Do not wrap runtime primitives in Promise.all; use .each() / .all() fan-out instead.
  • The pipeline runtime hides task handles and queue details from pipeline authors.

More examples

See .memory/sdk/cookbook.md for more recipes.