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

infinite-faq

v0.1.1

Published

AI-powered infinite FAQ. Static Q&A plus an ask-anything input that streams answers into the list. Full-stack and fully Tailwind-designable.

Readme

infinite-faq

AI-powered, infinitely growing FAQ. Keep your static questions, then add an "Anything else?" input where visitors ask their own question, have the answer stream in, and watch it slide into the list as a new FAQ item.

Full-stack and fully designable with Tailwind. Bring your own key, model and system prompt.

  • Streaming answers — text appears as it is generated.
  • Headless or styled — use InfiniteFaq as-is or the useInfiniteFaq hook.
  • Bring your own model — any AI SDK model, with a one-line OpenRouter helper.
  • Designable — every part accepts classNames, or override with Tailwind.
  • Scoped — lock the assistant to your site with a system prompt and an optional knowledge list.
  • Zero-config transport — a Next.js route factory plus a generic Request handler.

Install

npm install infinite-faq ai
# optional, for the OpenRouter helper
npm install @openrouter/ai-sdk-provider

Tailwind setup

infinite-faq ships Tailwind class names, so your Tailwind build must scan the package:

Tailwind v4 (app/globals.css):

@import "tailwindcss";
@source "../node_modules/infinite-faq/dist";

Tailwind v3 (tailwind.config.ts):

export default {
  content: [
    "./app/**/*.{ts,tsx}",
    "./node_modules/infinite-faq/dist/**/*.{js,cjs}",
  ],
}

The default styles use shadcn-style tokens (bg-card, text-muted-foreground, border-border, text-destructive, ring-ring). If you don't use those, pass classNames to match your design system, or map the tokens in @theme.

Quick start (Next.js App Router)

1. Create the route

app/api/faq/route.ts

import { createOpenRouterFaqRoute } from "infinite-faq/openrouter"

export const { POST, OPTIONS, maxDuration } = createOpenRouterFaqRoute({
  apiKey: process.env.OPENROUTER_API_KEY,
  model: "deepseek/deepseek-v4.1-flash",
  system: `You are the assistant for ACME. Only answer questions about ACME
and its products. Keep answers to 1-3 short sentences.`,
})

2. Render the component

import { InfiniteFaq } from "infinite-faq"

export function Faq() {
  return (
    <InfiniteFaq
      endpoint="/api/faq"
      eyebrow="FAQ"
      title="Frequently asked questions"
      items={[
        { question: "What is ACME?", answer: "ACME makes everything." },
        { question: "How much does it cost?", answer: "One-time $1,999." },
      ]}
    />
  )
}

That's it — static items, plus an input where visitors ask anything and the streamed answer is appended to the list.

Custom styling

Every part is overridable, and maxLines clamps answers with a scroll.

<InfiniteFaq
  endpoint="/api/faq"
  items={items}
  placeholder="Ask us anything…"
  loadingText="Searching our docs…"
  maxLines={6}
  className="max-w-3xl"
  classNames={{
    item: "rounded-3xl border-neutral-800 bg-neutral-950",
    trigger: "py-6 text-lg",
    answer: "text-neutral-400",
    form: "rounded-3xl border-neutral-800",
  }}
/>

| classNames key | Applies to | | --- | --- | | root, header, title, description, list | Layout | | item, trigger, question, icon, content, answer | Each Q&A item | | loading, error | Generated answer states | | form, input, submit | The "Anything else?" row |

Other useful props: submitIcon, renderIcon({ open }), duration, linkify, linkClassName, defaultOpenIndex, errorMessage, onEntryAdded, onError.

Headless usage

Build any UI you want; keep streaming, cancellation and state for free.

"use client"
import { useInfiniteFaq, createEndpointAsk } from "infinite-faq"

const ask = createEndpointAsk({ endpoint: "/api/faq" })

function MyFaq() {
  const { entries, ask: askQuestion, isLoading } = useInfiniteFaq({ ask })

  return (
    <div>
      {entries.map((entry) => (
        <article key={entry.id}>
          <h3>{entry.question}</h3>
          <p>{entry.answer || (isLoading ? "…" : "")}</p>
        </article>
      ))}
      <button onClick={() => askQuestion("How does it work?")}>Ask</button>
    </div>
  )
}

Bring your own model

createFaqHandler accepts any AI SDK LanguageModel, so you are not locked to OpenRouter.

import { createFaqRoute } from "infinite-faq/server"
import { openai } from "@ai-sdk/openai"

export const { POST, maxDuration } = createFaqRoute({
  model: openai("gpt-4o-mini"),
  system: "You are ACME's FAQ assistant.",
})

The handler also works as a plain Request/Response function — use it in Remix, Hono, Bun, Deno or any runtime:

import { createFaqHandler } from "infinite-faq/server"

const handleFaq = createFaqHandler({ model, system })
// handleFaq(request) -> Response

Server API

createFaqRoute(options)

Returns { POST, OPTIONS, maxDuration } for a Next.js route file.

| Option | Type | Description | | --- | --- | --- | | model | LanguageModel | Required. Any AI SDK model. | | system | string | System prompt; scope the assistant here. | | maxDuration | number | Seconds; re-exported as maxDuration. | | allowSystemMessages | boolean | Accept system messages from the client. Default false. | | cors | true \| string[] | Allow any origin or an allow-list. | | onError | (error) => void | Called on request/stream failure. |

The endpoint accepts { prompt: string } or { messages: { role, content }[] } and responds with a text/plain stream. Errors are returned as JSON { error } with a 4xx/5xx status.

createOpenRouterFaqRoute(options) / createOpenRouterFaqHandler(options)

Everything above, plus apiKey, model (id string), appName, appUrl and compatibility. Import from infinite-faq/openrouter.

Roadmap

  • [ ] Pluggable retrieval (Pinecone, Redis, pgvector) for grounded answers
  • [ ] Tool calling (e.g. fetch pricing, check order status)
  • [ ] Conversation history in InfiniteFaq
  • [ ] React Server Component / no-JS streaming variant
  • [ ] Vue and Svelte bindings on the same headless core

License

MIT