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

typemock-ai

v1.0.0

Published

Type is Truth. AI Mock Data Generator powered by TypeScript AST & JSDoc semantics.

Readme

TypeMock AI

Bun TypeScript License: MIT

Type is Truth. AI-powered Mock Data Generator that understands your TypeScript interfaces and JSDoc semantics.

Features

  • Type-to-Mock - Automatically parse TypeScript interfaces and generate matching mock data
  • JSDoc Semantics - AI reads your JSDoc comments to generate contextually accurate data
  • Live Watch Mode - Auto-regenerate when your type definitions change
  • Multi-Model Support - Works with OpenAI, DeepSeek, Moonshot, Gemini, and more
  • HTTP API - RESTful endpoints for easy integration
  • Beautiful CLI - Modern terminal UI with spinners and colors

Quick Start

Installation

# Install globally
bun add -g typemock-ai

# Or run directly
bunx typemock-ai

Setup API Key

Create a .env file or export environment variables:

# OpenAI
export OPENAI_API_KEY="sk-xxx"

# Or DeepSeek (recommended, cost-effective)
export OPENAI_API_KEY="sk-xxx"
export OPENAI_BASE_URL="https://api.deepseek.com"
export OPENAI_MODEL="deepseek-chat"

# Or Gemini
export OPENAI_API_KEY="AIzaSyXXX"
export OPENAI_BASE_URL="https://generativelanguage.googleapis.com/v1beta/openai/"
export OPENAI_MODEL="gemini-2.0-flash"

Run

# Interactive mode
bun run dev

# Quick mode (skip prompts)
bun run start

Usage

Define Your Interface

Create a TypeScript file with JSDoc annotations:

// examples/demo.ts

/**
 * User profile information
 */
export interface UserProfile {
  /** Unique user ID, UUID format */
  id: string;

  /** Username, 3-20 characters, alphanumeric only */
  username: string;

  /** User email address */
  email: string;

  /** User age, range 1-150 */
  age: number;

  /** VIP status */
  isVip: boolean;

  /** User level: 'bronze' | 'silver' | 'gold' | 'platinum' */
  level: "bronze" | "silver" | "gold" | "platinum";
}

Generate Mock Data

# Start the server
bun run dev

# Request mock data
curl http://localhost:3000/api/mock/UserProfile

Response

{
  "data": {
    "id": "8f9d88a2-1b3c-4e1d-9b7a-7c6e5a3b2f1a",
    "username": "john_doe123",
    "email": "[email protected]",
    "age": 28,
    "isVip": true,
    "level": "gold"
  },
  "meta": {
    "interfaceName": "UserProfile",
    "fromCache": false
  }
}

API Endpoints

| Method | Endpoint | Description | |--------|----------|-------------| | GET | / | API information | | GET | /api/interfaces | List all available interfaces | | GET | /api/mock/:name | Generate mock data for interface | | GET | /api/mock/:name?force=true | Force regenerate (skip cache) | | DELETE | /api/cache/:name | Clear cache for interface | | DELETE | /api/cache | Clear all cache |

Configuration

Environment Variables

| Variable | Description | Default | |----------|-------------|---------| | OPENAI_API_KEY | API key (required) | - | | OPENAI_BASE_URL | API base URL | https://api.openai.com/v1 | | OPENAI_MODEL | Model name | gpt-3.5-turbo | | PORT | Server port | 3000 | | TS_FILE_PATH | TypeScript file to parse | examples/demo.ts |

Supported Models

| Provider | Base URL | Model | |----------|----------|-------| | OpenAI | https://api.openai.com/v1 | gpt-3.5-turbo, gpt-4 | | DeepSeek | https://api.deepseek.com | deepseek-chat | | Moonshot | https://api.moonshot.cn/v1 | moonshot-v1-8k | | Gemini | https://generativelanguage.googleapis.com/v1beta/openai/ | gemini-2.0-flash |

Build

Generate a standalone executable:

bun run build
# Output: dist/typemock

Project Structure

typemock-ai/
├── src/
│   ├── core/
│   │   ├── parser.ts      # TypeScript AST parser
│   │   ├── generator.ts   # AI mock generator
│   │   ├── cache.ts       # File-based cache
│   │   └── watcher.ts     # File watcher
│   ├── server.ts          # Hono HTTP server
│   └── index.ts           # CLI entry point
├── examples/
│   └── demo.ts            # Sample interfaces
├── .env.example           # Environment template
└── package.json

How It Works

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│  TypeScript     │     │   AST Parser    │     │   AI Generator  │
│  Interface      │ ──▶ │   (ts-morph)    │ ──▶ │   (OpenAI SDK)  │
│  + JSDoc        │     │                 │     │                 │
└─────────────────┘     └─────────────────┘     └─────────────────┘
                                │                       │
                                ▼                       ▼
                        ┌─────────────────┐     ┌─────────────────┐
                        │  Field Schema   │     │  Realistic      │
                        │  - name         │     │  Mock Data      │
                        │  - type         │     │  (JSON)         │
                        │  - docs (JSDoc) │     │                 │
                        └─────────────────┘     └─────────────────┘

License

MIT