qrcode-terminal

Render QR codes as ASCII art directly in a terminal or console

Library
npm
v0.12.0
1,350stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
35/100Needs Attention
Development Activity0
Maintenance0
Community52
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
67/100Good
Architecture55
Code Quality62
Innovation60
Learning Curve92

qrcode-terminal is a small Node.js library that generates a QR code and prints it as ASCII/ANSI art straight to standard output, so a URL or piece of text can be scanned directly off a terminal window instead of being rendered to an image file. It exposes a simple qrcode.generate(text) call for programmatic use plus a globally-installable CLI binary for ad-hoc use from the command line.

It’s most widely known as the library behind the QR code shown by tools like the npm CLI’s web-based login flow, and is commonly reached for by CLI tools and dev servers (Expo, ngrok-style tunnels, pairing flows) that need to hand a URL to a phone without leaving the terminal.

What You Get

  • A generate(text, [opts], [callback]) function that prints (or returns via callback) a QR code as terminal text
  • A qrcode-terminal CLI binary usable directly or via stdin (echo url | qrcode-terminal)
  • Configurable error-correction level via setErrorLevel()
  • A small option for a more compact QR rendering suited to narrower terminals
  • Cross-platform support for macOS, Linux, and Windows terminals

Common Use Cases

  • CLI tools and dev servers that display a URL as a scannable QR code for mobile pairing (e.g. Expo, local dev servers, auth flows)
  • Authentication flows like npm’s web-based login that show a QR code in the terminal instead of opening a browser
  • Quick ad-hoc sharing of a URL or short text from the command line via the bundled CLI
  • Embedding QR output inside larger CLI tools’ terminal UIs

Under The Hood

Architecture: The library is a thin wrapper (lib/main.js) around a bundled QR-encoding implementation in vendor/, converting the encoded QR matrix into terminal block characters; the bin/qrcode-terminal.js script is a small CLI wrapper around that same generate() call, reading from process.argv or stdin. Tech Stack: Plain JavaScript with zero runtime dependencies, tested with mocha/expect.js/sinon and linted with jshint. Code Quality: The test/ directory covers the core generation and error-level API; the project has been stable and dependency-free since its last release in 2018, reflecting a finished, low-churn utility rather than actively evolving software. API Design: The API is intentionally tiny — one generate() call with an optional callback and options object — which is why it’s frequently pulled into much larger CLIs (npm, Expo, tunneling tools) as a one-off dependency for a single feature.

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

Search