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

prai

v0.4.16

Published

JS Framework for building step-by-step LLM instructions

Readme

Writing prompts in natural language is great—until they become messy with multiple steps, output format descriptions, and too many lines of text...

With prai, prompts become code—structured, maintainable, and debuggable—leading to high-quality, reliable outputs.

npm install prai

What does it look like?

import { History, Model, openai, step } from 'prai'
import { z } from 'zod'

// 1. Inputs for our theme generation process
const brandName = `pmndrs`
const brandDescription = `Open source developer collective`

// 2. Zod schema for a color in hsl - will be given to the LLM as the expected output format
const colorScheme = z
  .object({
    hue: z.number().describe('in degree (0-360)'),
    saturation: z.number().describe('in percent (0-100)'),
    lightness: z.number().describe('in percent (0-100)'),
  })
  .describe('hsl color')

// 3. Create a model based on an AI provider (openai, groq, more support comming soon)
const model = new Model({ name: 'gpt-4.1-mini', apiKey: 'insert key here', provider: openai({ apiKey: "" }) })

// 4. create a chat history
const history = new History()

// 5. First step
const adjectives = await step(
    //6. Enforce a strict schema on the output (a list of strings) - LLM will be forced to comply
  `list some adjectives fitting the design of the ${brandName} brand which is a ${brandDescription}`,
  z.array(z.string()),
  { model, history }
)

// 7. Second step—generate a basic theme
const coreTheme = await step(
  // 9. We can reference results from history using history.reference
  `Based on the ${history.reference(adjectives)}, derive fitting color theme`,
  z.object({
    background: colorScheme,
    foreground: colorScheme,
    primary: colorScheme,
    secondary: colorScheme,
    accent: colorScheme,
    border: colorScheme,
    radius: z.number().describe('radius in rem'),
  }),
  { model, history }
)

// 10. Final step—expand into a full shadcn theme
const result = await step(
  `Expand the ${history.reference(coreTheme)} to a full shadcn theme`,
  z.object({
    background: colorScheme,
    //Full scheme in /examples/theme
  }),
  { model, history }
)

console.log(result.value)

Documentation

Explore the complete prai documentation to learn everything from basic concepts to advanced patterns:

Getting Started

  • Introduction - Overview of prai concepts and core philosophy
  • Your First Workflow - Step-by-step tutorial building a complete brand theme generator
  • Special Step Types - Specialized functions for data processing (mapStep, filterStep, combineStep, etc.)
  • Advanced Usage - Streaming responses, conditional workflows, model fallbacks, and testing strategies
  • Best Practices - Production guidelines and optimization tips

Core Concepts

  • Steps - Fundamental building blocks of prai workflows with schema integration and examples
  • Models - AI provider abstraction supporting OpenAI, Groq, Gemini, and mock providers
  • History - Conversation tracking, reference system, subtasks, and multimodal support

TODO:

[ ] write model to log [ ] allow overriding response and cost field through step options