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

@cxai/faker

v0.3.0

Published

Template-based fake data generator that pushes items into Yjs collections. Usable as module or standalone server.

Readme

@cxai/faker

Template-based fake data generator for Yjs. Uses @faker-js/faker templates to produce items and push them into Y.Map collections with progress tracking and toggle control.

Install

npm install @cxai/faker

Usage

Standalone — generate items

import { generateFromTemplate, createFakerIterable, createFakerJob } from "@cxai/faker";
import * as Y from "yjs";

// Single item
const user = generateFromTemplate({ id: "{{string.uuid}}", name: "{{person.fullName}}" });

// Async generator (no Yjs dependency)
for await (const { item, progress } of createFakerIterable(template, { count: 5 })) {
  console.log(`${progress}%`, item);
}

// Self-contained Yjs job
const doc = new Y.Doc();
const job = createFakerJob(doc, "users", {
  id: "{{string.uuid}}",
  name: "{{person.fullName}}",
  email: "{{internet.email}}",
}, { count: 20, interval: [200, 500], autoStart: true });

job.getStatus();  // { status: "running", progress: 40 }
job.stop();
job.clear();
job.destroy();

Combined with @cxai/job

import { createFakerIterable } from "@cxai/faker";
import { createJob } from "@cxai/job";

const job = createJob({
  doc,
  path: "products",
  iterable: () => createFakerIterable({ id: "{{string.uuid}}", name: "{{commerce.productName}}" }, { count: 100 }),
});
job.trigger();

Combined with @cxai/yapi

import { createFakerJob } from "@cxai/faker";
import { createApp } from "@cxai/yapi";

const doc = new Y.Doc();
createFakerJob(doc, "orders", template, { count: 50, autoStart: true });

const api = createApp(doc, {
  routes: { "/orders": { collection: "orders", sse: { event: "new-order" } } },
});
// SSE streams fake items as they're generated

HTTP App (@cxai/faker/app)

import fakerApp from "@cxai/faker/app";

fakerApp.config(doc, {
  users: { collection: "users", template: { id: "{{string.uuid}}", name: "{{person.fullName}}" }, options: { count: 10 } },
  orders: { collection: "orders", template: { id: "{{string.uuid}}", total: "{{commerce.price}}" } },
});

app.route("/faker", fakerApp);
// POST /faker/users/start
// POST /faker/users/stop
// POST /faker/users/clear
// GET  /faker/status        — all jobs
// GET  /faker/users/config  — job definition

API Reference

generateFromTemplate<T>(template): T

Generate a single object. Template values are @faker-js/faker expressions like "{{person.fullName}}". Date/time fields are auto-converted to ISO strings.

createFakerIterable<T>(template, options?): AsyncGenerator<{ item: T, progress: number }>

Pure async generator — no Y.Doc dependency.

| Option | Type | Default | Description | |--------|------|---------|-------------| | count | number | 10 | Items to generate | | interval | [min, max] | [1000, 2000] | Delay range in ms between items | | until | Date \| number | — | Stop after this time |

createFakerJob<T>(doc, collection, template, options?)

Self-contained job that pushes into doc.getMap(collection). Returns:

| Method | Description | |--------|-------------| | trigger() | Start generation | | stop() | Abort | | isRunning() | boolean | | getStatus() | { status, progress, lastSyncTime? } | | getItems() | T[] | | clear() | Stop + clear items | | destroy() | Cleanup observers | | paths | { collection, statusPath, togglePath } |

Additional options: autoStart, statusPath, togglePath.

Re-export

export { faker } from "@faker-js/faker"; // convenience re-export

Examples

See Also