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

ai-faker-js

v1.0.1

Published

Ai faker js is an faker object generator with ai

Downloads

13

Readme

AIFaker.js 🧠🤖

Generate structured fake data using AI (https://console.groq.com/) effortlessly!

This package has initilized with vibe coding in 30 minutes

🚀 Features

  • Schema-based generation: Define precise JSON structures.
  • AI-powered data: Uses OpenAI's models to generate realistic fake data.
  • Multi-language support: Control output language globally.
  • Custom prompts: Define per-field prompts for accurate results.

📦 Installation

npm install ai-faker-js

or

yarn add ai-faker-js

🛠️ Usage

1️⃣ Initialize the Library

import { init, generate } from "ai-faker-js";

init({
  apiKey: "gsk_ai0x...",  // Your Groq API key (https://console.groq.com/)
  model: "llama-3.3-70b-versatile",     // AI model to use
  language: "en"      // Default language ("en", "fr", "es", "de", etc.)
});

2️⃣ Basic Text Generation

const fakeBio = await generate("Generate a short biography for a fictional character.");
console.log(fakeBio);

3️⃣ Structured Data Generation

You can define a strict schema to control the AI's output:

const userSchema = {
  object: {
    name: { type: "string", description: "A common first name" },
    age: { type: "number", description: "An age between 18 and 65" },
    email: "string"
  },
  description: "A realistic fictional user"
};

const fakeUser = await generate("Generate a fictional user", userSchema);
console.log(fakeUser);

4️⃣ Array Example: Generating Multiple Items

const productSchema = {
  array: {
    object: {
      id: { type: "string", description: "A unique product identifier" },
      name: "string",
      price: { type: "number", description: "Price in USD" },
    }
  },
  length: 10, // Generate 10 products
  description: "A list of fake products"
};

const fakeProducts = await generate("Generate a list of 10 products", productSchema);
console.log(fakeProducts);

⚙️ API Reference

init(options: FakerAiOptions)

Initialize the library with API credentials and settings.

Parameters:

| Name | Type | Required | Description | |----------|----------|----------|-------------| | apiKey | string | ✅ | OpenAI API key | | model | string | ✅ | AI model (e.g., "gpt-4") | | language | "en" | "fr" | "es" | "de" | ❌ (default "en") | Default output language |


generate(prompt: string, schema?: SchemaType): Promise<any>

Generates data based on a custom prompt and optional schema.

Parameters:

| Name | Type | Required | Description | |-----------|---------------|----------|-------------| | prompt | string | ✅ | Custom AI prompt | | schema | SchemaType | ❌ | Optional strict data structure |


📝 Schema Definition

The schema allows you to enforce a structured JSON output.

Basic Types

| Type | Example | |----------|---------| | "string" | "John Doe" | | "number" | 42 | | "boolean" | true | | "date" | "2025-01-01" |

Object Example

const personSchema = {
  object: {
    firstName: "string",
    lastName: "string",
    age: { type: "number", description: "Between 18 and 60" }
  }
};

Array Example

const usersSchema = {
  array: {
    object: {
      name: "string",
      email: "string"
    }
  },
  length: 5, // Generate 5 users
};

🌎 Multi-Language Support

The library supports multiple output languages.
Set the language in init() to "en", "fr", "es", "de", etc.

init({ apiKey: "sk-xxx", model: "gpt-4", language: "fr" });
const fakeUser = await generate("Génère un utilisateur fictif", userSchema);
console.log(fakeUser);

🏗️ Roadmap

  • [ ] Custom field validation
  • [ ] Support for enums ("male" | "female" etc.)
  • [ ] Custom AI model configuration
  • [ ] Improved performance with caching

💡 Why Use AIFaker.js?

✅ No more manually creating fake data 🚀
✅ Ensures realistic and structured outputs 🧠
✅ Fully customizable with AI-powered generation 🤖


🛠️ Contributing

Pull requests are welcome! If you find a bug or want to request a feature, feel free to open an issue.