Prompts

Lightweight, beautiful and user-friendly interactive CLI prompts for Node.js.

Library
npm
v2.4.2
9,312 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
45 /100 Fair
Development Activity 0
Maintenance 20
Community 60
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
84 /100 Excellent
Architecture 85
Code Quality 78
Innovation 86
Learning Curve 88

Prompts is a small, dependency-light Node.js library for building interactive command-line interfaces that ask users for input. It ships twelve unified prompt types — text, password, number, confirm, select, multiselect, autocomplete, date, and more — behind a single promise-based API that plays naturally with async/await.

Designed for CLIs, scaffolding tools, and setup wizards, it favors a clean layout with colored output, per-question validation, dynamic prompt chaining, and a testable inject mechanism for scripting answers. With no heavy dependencies and a consistent experience across every prompt, it has become one of the most widely used prompt libraries in the npm ecosystem.

What You Get

  • Twelve unified prompt types (text, password, invisible, number, confirm, list, toggle, select, multiselect, autocomplete, autocompleteMultiselect, date) with a consistent look and feel.
  • A promise-based API built around async/await, so prompt chains read as ordinary asynchronous code with no callback nesting.
  • Per-question validation, formatting, and dynamic prompts whose type, message, or initial value can be computed from previous answers.
  • An inject() testing hook and an override() helper for supplying answers programmatically from CLI arguments or test fixtures.
  • A tiny dependency footprint (only kleur and sisteransi) and bundled TypeScript definitions.

Common Use Cases

  • Building setup wizards and project scaffolding CLIs that gather configuration interactively.
  • Prompting for confirmations, credentials, or selections inside developer tooling and build scripts.
  • Collecting structured multi-step input where later questions depend on earlier answers.

Under The Hood

Architecture

The entry point index.js re-exports lib/index.js, whose prompt() function is the whole orchestration layer: it normalizes a single question or array into a list, resolves any function-valued properties against the answers collected so far, evaluates the type (skipping falsy types), and dispatches to the matching prompter in lib/prompts.js. Each prompter in lib/prompts.js constructs a corresponding element class from lib/elements/ (TextPrompt, NumberPrompt, SelectPrompt, etc.) and wraps its submit/abort/exit events in a promise. Every element extends a base Prompt (lib/elements/prompt.js) that owns the readline interface, raw-mode keypress handling, and cursor control via sisteransi, while shared rendering helpers live in lib/util/.

Tech Stack

Pure JavaScript (CommonJS) targeting Node 14+, with only two runtime dependencies: kleur for terminal colors and sisteransi for ANSI cursor/erase sequences. Terminal input is handled with Node’s built-in readline and EventEmitter. Hand-written TypeScript definitions ship in index.d.ts. Tooling is minimal — tape with tap-spec for tests and tsc for type-declaration checks.

Code Quality

The codebase is compact and well-factored, splitting responsibilities cleanly across an orchestrator, per-type element classes, and utility modules, with JSDoc annotations on the public surface. A test suite exists (test/prompts.js, test/text.js, test/util.js, plus test/type-declarations.ts) covering the core prompter and text element, though coverage is focused rather than exhaustive. Error handling is explicit for missing messages and undefined prompt types, and cancellation is modeled through the abort/exit event paths.

API Design

The public API is deliberately tiny — a single callable that takes declarative question objects and returns a keyed answers object — which keeps the mental model small and the getting-started boilerplate near zero. Consistent property names (type, name, message, initial, format, validate) across every prompt type, first-class async support, and the function-valued property convention make dynamic flows expressive. The README is thorough with per-type documentation and runnable examples, and inject()/override() give a clean testing story.

Used by 26 apps in this directory

Rust
99%
GPL 3.0

Pake

Developer Tools

62,284

Turn any webpage into a lightweight native desktop app with one command — built on Rust/Tauri instead of Electron, producing installers nearly 20x smaller (typically under 10MB) for macOS, Windows, and Linux.

View details
94
Repo Health
75
Technical
72
Dependency
Built with
Rust 99%
Updated 5 days ago
TypeScript
96%
MIT

Payload CMS

Blogging · CMS · Developer Tools

45,458

The open-source, Next.js-native headless CMS that lives inside your /app folder and gives you a full TypeScript backend instantly.

View details
92
Repo Health
88
Technical
65
Dependency
Built with
TypeScript 96%
Updated 5 days ago
TypeScript
91%
AGPL 3.0

PeerTube

Social Media

15,362

A federated, ActivityPub-based video hosting platform built by Framasoft — self-hostable instances interconnect into a network with no vendor lock-in, P2P-assisted streaming, and no ads.

View details
96
Repo Health
75
Technical
66
Dependency
Built with
TypeScript 91%
Updated 1 weeks ago
TypeScript
89%
Other

strapi

CMS

73,368

Open-source headless CMS that auto-generates REST and GraphQL APIs from your content models, with a fully customizable admin panel you control.

View details
93
Repo Health
84
Technical
63
Dependency
Built with
TypeScript 89%
JavaScript 11%
Updated 6 days ago
TypeScript
98%
Apache 2.0

Tianji

Analytics · Monitoring

3,119

Replace Google Analytics, UptimeKuma, and Prometheus with one self-hosted platform that tracks websites, monitors uptime, and reports server health.

View details
86
Repo Health
76
Technical
64
Dependency
Built with
TypeScript 98%
Updated 6 days ago
TypeScript
98%
Apache 2.0

TinaCMS

CMS

13,845

An open-source, Git-backed headless CMS that gives editors a live visual editing UI over Markdown, MDX, JSON, and YAML content while developers keep everything in version control.

View details
92
Repo Health
74
Technical
59
Dependency
Built with
TypeScript 98%
Updated 6 days ago
TypeScript
65%
Other

Typebot

AI Assistants · AI Development · Developer Tools

10,576

Build sophisticated chatbots visually, embed them anywhere without iframes, and own your data — fully self-hostable with a modular block system and 30+ integrations.

View details
94
Repo Health
82
Technical
64
Dependency
Built with
TypeScript 65%
MDX 34%
Updated 6 days ago
TypeScript
99%
MIT

Umami

Analytics

39,609

Privacy-first web analytics that respects your users — self-hosted, cookieless, and GDPR compliant out of the box.

View details
95
Repo Health
83
Technical
67
Dependency
Built with
TypeScript 99%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers