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

@prismfy/prismfy

v1.0.0

Published

Official JavaScript/TypeScript SDK for the Prismfy web search API

Readme

Prismfy JavaScript / TypeScript SDK

Official JS/TS client for the Prismfy web search API. Works in Node.js 18+, Bun, Deno, and modern browsers.

Installation

npm install prismfy
# or
yarn add prismfy
# or
pnpm add prismfy

Quick start

import { Prismfy } from 'prismfy'

const client = new Prismfy({ apiKey: 'ss_live_...' })

const result = await client.search('best Python libraries 2026')

for (const r of result.results) {
  console.log(r.title)
  console.log(r.url)
  console.log(r.content.slice(0, 200))
  console.log()
}

Use environment variables (recommended):

export PRISMFY_API_KEY="ss_live_..."
const client = new Prismfy()  // reads PRISMFY_API_KEY automatically

Features

  • ✅ Full TypeScript support — complete type definitions included
  • ✅ Zero dependencies — uses native fetch (Node 18+, browsers, Bun, Deno)
  • ✅ Works in browsers, Node.js, Bun, Deno, and edge runtimes (Vercel, Cloudflare)
  • ✅ ESM + CommonJS — both module formats shipped
  • ✅ Typed error hierarchy with specific exception classes
  • ✅ Overloaded search() — accepts string or object

Usage

Search

// Simple string argument
const result = await client.search('TypeScript generics')

// Full options
const result = await client.search('transformer architecture', {
  engines:   ['arxiv', 'pubmed', 'google'],  // Pro/Enterprise
  timeRange: 'month',
  language:  'en',
  page:      1,
})

// Domain-scoped
const result = await client.search('Array.from()', {
  domain: 'developer.mozilla.org',
})

// Object-style (alternative)
const result = await client.search({
  query:    'rust async programming',
  page:     2,
  engines:  ['google', 'bing'],
})

// Access results
console.log(`${result.results.length} results, cached: ${result.cached}`)
console.log(`Duration: ${result.meta.durationMs}ms`)
console.log(`Engines: ${result.meta.engines.join(', ')}`)

User profile & quota

const profile = await client.user.me()
console.log(profile.tier)              // 'free' | 'pro' | 'enterprise'
console.log(profile.quota.remaining)   // requests left this month
console.log(profile.quota.expiresAt)   // reset date

Search history

const history = await client.user.searches({ limit: 20 })
for (const item of history.searches) {
  console.log(item.query, item.status, item.durationMs)
}

Usage / billing log

const usage = await client.user.usage({ limit: 50 })
for (const event of usage.history) {
  console.log(event.event, event.createdAt)
}

API key management

// List all keys
const keys = await client.user.keys()

// Create a new key
const newKey = await client.user.createKey({ name: 'Production' })
console.log(newKey.key)  // ss_live_... — save this, shown only once!

// Delete a key (immediately invalidated)
await client.user.deleteKey(newKey.id)

Plans & engine catalog

const { plans, allEngines, engines } = await client.plans()

plans.forEach(p => {
  console.log(`${p.name}: ${p.limits.rpm} rpm, ${p.limits.requestsMonth} req/mo`)
})

console.log('All engines:', allEngines)
// ['google', 'bing', 'brave', 'yahoo', 'yahoo news', 'hackernews', ...]

Health check

const health = await client.health()
console.log(health.status, health.checks)
// { status: 'ok', checks: { db: 'ok', redis: 'ok' } }

Error handling

import {
  Prismfy,
  PrismfyRateLimitError,
  PrismfyQuotaError,
  PrismfyAuthError,
  PrismfyTimeoutError,
  PrismfyError,
} from 'prismfy'

const client = new Prismfy()

try {
  const result = await client.search('query')
} catch (err) {
  if (err instanceof PrismfyRateLimitError) {
    console.log(`Rate limited. Retry after ${err.retryAfterSeconds}s`)
    await new Promise(r => setTimeout(r, err.retryAfterMs + 100))
  } else if (err instanceof PrismfyQuotaError) {
    console.log('Monthly quota exhausted. Upgrade your plan.')
  } else if (err instanceof PrismfyAuthError) {
    console.log('Invalid API key.')
  } else if (err instanceof PrismfyTimeoutError) {
    console.log('Search timed out. Try again.')
  } else if (err instanceof PrismfyError) {
    console.log(`API error: ${err.statusCode} ${err.code} — ${err.message}`)
  }
}

Retry with exponential backoff

async function searchWithRetry(
  client: Prismfy,
  query: string,
  maxRetries = 3,
) {
  for (let attempt = 0; attempt < maxRetries; attempt++) {
    try {
      return await client.search(query)
    } catch (err) {
      if (err instanceof PrismfyRateLimitError) {
        if (attempt === maxRetries - 1) throw err
        await new Promise(r => setTimeout(r, err.retryAfterMs + 100))
      } else if (err instanceof PrismfyTimeoutError) {
        if (attempt === maxRetries - 1) throw err
        await new Promise(r => setTimeout(r, 1000 * 2 ** attempt))
      } else {
        throw err
      }
    }
  }
}

Next.js / React example

// app/api/search/route.ts
import { Prismfy } from 'prismfy'
import { NextResponse } from 'next/server'

const client = new Prismfy()  // reads PRISMFY_API_KEY

export async function POST(req: Request) {
  const { query } = await req.json()
  const result = await client.search(query)
  return NextResponse.json(result)
}
// components/SearchBox.tsx
'use client'
import { useState } from 'react'
import type { SearchResponse } from 'prismfy'

export function SearchBox() {
  const [results, setResults] = useState<SearchResponse | null>(null)

  async function handleSearch(query: string) {
    const res = await fetch('/api/search', {
      method:  'POST',
      headers: { 'Content-Type': 'application/json' },
      body:    JSON.stringify({ query }),
    })
    setResults(await res.json())
  }

  return (
    <div>
      <input onKeyDown={e => e.key === 'Enter' && handleSearch(e.currentTarget.value)} />
      {results?.results.map(r => (
        <div key={r.url}>
          <a href={r.url}>{r.title}</a>
          <p>{r.content}</p>
        </div>
      ))}
    </div>
  )
}

Engine reference

| Engine | Category | Free | Pro/Enterprise | |--------|----------|------|----------------| | google | Web | ✅ | ✅ | | bing | Web | ✅ | ✅ | | brave | Web | — | ✅ | | yahoo | Web | — | ✅ | | yahoo news | News | — | ✅ | | hackernews | News | — | ✅ | | github | Code | — | ✅ | | pypi | Code | — | ✅ | | mdn | Code | — | ✅ | | arxiv | Academic | — | ✅ | | pubmed | Academic | — | ✅ | | huggingface | AI | — | ✅ | | reddit | Community | — | ✅ | | wikipedia | Reference | — | ✅ | | askubuntu | Q&A | — | ✅ |

License

MIT