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

@pupt/lib

v1.7.2

Published

TypeScript library for creating AI prompts using JSX syntax

Downloads

701

Readme

pupt-lib

npm version Coverage Status CI

A TypeScript library for creating AI prompts as versionable, composable, shareable files using JSX syntax. Prompts are becoming critical software artifacts, yet most are written inline, copy-pasted between projects, and lost when chat sessions end. pupt-lib treats prompts as first-class code: version controlled in git, composable from reusable components, and shareable via npm. Simple prompts look like HTML and are accessible to non-developers, while complex prompts have full TypeScript power including loops, conditionals, and type safety.

Read the full documentation — guides, component reference, API docs, and more.

Installation

npm install pupt-lib

For build-time JSX transformation (recommended for production), also install the peer dependencies:

npm install --save-dev @babel/core @babel/plugin-transform-react-jsx @babel/preset-typescript

Quick Start

The simplest way to write a prompt is a .prompt file — no imports or exports needed:

<!-- greeting.prompt -->
<Prompt name="greeting" description="A friendly greeting prompt">
  <Role>You are a friendly assistant.</Role>
  <Task>
    Greet the user named <Ask.Text name="userName" label="User's name" /> warmly.
  </Task>
  <Constraint type="must">Keep the greeting under 50 words.</Constraint>
</Prompt>

Load and render it:

import { createPromptFromSource, render } from 'pupt-lib';
import { readFile } from 'fs/promises';

const source = await readFile('./greeting.prompt', 'utf-8');
const element = await createPromptFromSource(source, 'greeting.prompt');
const result = await render(element, {
  inputs: { userName: 'Alice' },
});

console.log(result.text);

You can also write prompts as .tsx files for full TypeScript type safety — see the Getting Started guide for details.

Features

  • JSX Syntax — Write prompts using familiar JSX/TSX syntax with 50+ built-in components
  • .prompt Files — Simplified format with no imports, no exports — just JSX
  • Composable — Build complex prompts from reusable, shareable components
  • Provider Targeting — Adapt output for Claude, GPT, Gemini, and others via environment config
  • Presets — Role, task, constraint, and steps presets encode prompt engineering best practices
  • Smart Defaults — Auto-generated role, format, and constraint sections with full opt-out control
  • Version Controlled — Prompts live in files, tracked in git, reviewed in PRs
  • Shareable — Publish prompt libraries to npm, consume others' work via npm, URLs, or local files
  • Browser & Node.js — Works in both environments with runtime JSX transformation

Documentation

Visit apowers313.github.io/pupt-lib for:

License

MIT