qrcode

A zero-dependency-on-canvas QR code and 2D barcode generator for Node.js and the browser.

Library
npm
v1.5.4
8,180 stars
MIT License

Repository Health

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

Technical Analysis

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

qrcode is an npm library for generating QR codes and 2D barcodes from server-side Node.js code or directly in the browser. It builds the QR symbol from scratch (segment optimization, Reed-Solomon error correction, mask-pattern selection) and ships pluggable renderers that can output the result as a PNG file or buffer, an SVG string, a data URL, raw terminal text, or directly onto an HTML5 canvas element.

Both a callback-based and a Promise/async-await API are supported for every render target, and the package also installs a qrcode CLI binary so a QR code can be generated or previewed from a shell one-liner without writing any code.

What You Get

  • A spec-compliant QR Code encoder supporting Numeric, Alphanumeric, Kanji, and Byte modes with automatic mixed-mode segmentation for the smallest possible symbol
  • Renderers for canvas, PNG (file, buffer, or data URL), SVG, UTF-8/terminal text, and writable file streams
  • A dual callback/Promise API across every render function (toDataURL, toBuffer, toFile, toFileStream, toString, toCanvas)
  • A globally installable qrcode CLI for generating QR images or previewing them directly in the terminal
  • Configurable error correction levels (L/M/Q/H), symbol version, mask pattern, quiet zone, and custom foreground/background colors

Common Use Cases

  • Generating login/2FA QR codes (e.g. TOTP otpauth:// URIs) for authenticator app enrollment
  • Rendering shareable QR codes for URLs, contact cards, or Wi-Fi credentials on server-rendered pages or PDFs
  • Embedding scannable payment or ticket codes in receipts and event passes generated as PNG/SVG assets
  • Client-side QR generation directly onto a <canvas> element for real-time previews as a user types

Under The Hood

Architecture — The encoder lives entirely under lib/core/ as a pipeline of small, single-purpose modules: segments.js splits input into Numeric/Alphanumeric/Kanji/Byte runs, version.js picks the smallest QR version that fits, bit-buffer.js and reed-solomon-encoder.js/polynomial.js/galois-field.js build and error-correct the codeword stream, and qrcode.js (createSymbol) assembles the final BitMatrix by laying down finder, timing, alignment, and format-info patterns before mask-pattern.js scores all eight masks and applies the best one. lib/index.js (Node) and lib/browser.js (browser) are thin adapters that call QRCode.create() and hand the resulting matrix to one of five interchangeable renderers under lib/renderer/ (canvas, png, svg, terminal, utf8), so the same core encoder drives every output format.

Tech Stack — Runtime dependencies are minimal and purpose-built: pngjs for PNG encoding, dijkstrajs for shortest-path segment-mode optimization, and yargs for the CLI’s argument parsing. The browser bundle is produced via Rollup with Babel’s preset-env, and standard enforces lint rules as a pretest hook, so a broken style fails CI before tests even run.

Code Quality — Test coverage is thorough and organized to mirror the source layout: 26 unit test files under test/unit/core and test/unit/renderer exercise each internal module in isolation (bit-buffer, mask-pattern, reed-solomon-encoder, etc.), while test/e2e/*.test.js drives the public toCanvas/toDataURL/toFile/toFileStream/toString API end-to-end using tap and sinon. Functions are short, consistently documented with JSDoc blocks, and side effects (like the mutable toSJISFunc set on Utils) are the rare exception rather than the norm.

API Design — The public surface is deliberately small and uniform: every to* render function accepts the same (data, options, callback) shape and transparently returns a Promise when the callback is omitted, so consumers opt into whichever async style fits their codebase without adapter code. Getting a QR code onto the screen or into a file takes one line (QRCode.toDataURL(text, cb)), and the same mental model extends to the CLI binary, keeping the learning curve low for a spec-heavy domain.

Used by 54 apps in this directory

TypeScript
96%
Other

Infisical

Devops · Security

29,961

The open-source platform for secrets, certificates, privileged access, and AI agent security — all in one self-hostable system.

View details
91
Repo Health
84
Technical
64
Dependency
Built with
TypeScript 96%
Updated 6 days ago
TypeScript
61%
Unlicense

Invio

Invoicing Finance

1,193

Self-hosted invoicing without the bloat

View details
83
Repo Health
71
Technical
80
Dependency
Built with
TypeScript 61%
Svelte 29%
Updated 1 weeks ago
Vue
50%
GPL 3.0

IT-Tools

Developer Tools

40,954

A unified collection of 88 web-based developer utilities — from JSON formatting to subnet calculation — all self-hostable, keyboard-searchable, and offline-ready.

View details
60
Repo Health
74
Technical
63
Dependency
Built with
Vue 50%
TypeScript 48%
Updated 1 weeks ago
TypeScript
77%
Other

Joplin

Note Taking

56,853

The privacy-first, open-source note-taking app with end-to-end encrypted sync, AI assistance, and a powerful plugin ecosystem across every platform.

View details
93
Repo Health
87
Technical
60
Dependency
Built with
TypeScript 77%
JavaScript 14%
Updated 1 weeks ago
Python
53%
AGPL 3.0

LearnHouse

CMS · Learning Management

2,413

Open-source LMS with AI tutoring, real-time collaboration boards, live code execution, and built-in course monetization — self-hosted in minutes.

View details
90
Repo Health
77
Technical
65
Dependency
Built with
Python 53%
TypeScript 45%
Updated 6 days ago
Scala
62%
AGPL 3.0

lila (Lichess)

Community

18,881

The forever-free, ad-free, open-source chess server powering millions of real-time games, AI analysis, puzzles, and tournaments worldwide.

View details
89
Repo Health
80
Technical
69
Dependency
Built with
Scala 62%
TypeScript 27%
Updated 6 days ago
TypeScript
98%
MPL 2.0

Logto

Authentication

14,769

Open-source auth infrastructure for SaaS and AI apps with OIDC, SAML, and RBAC

View details
92
Repo Health
83
Technical
63
Dependency
Built with
TypeScript 98%
Updated 1 weeks ago
TypeScript
92%
Apache 2.0

Apache Maka

AI Agents · AI Development · Developer Tools

5,868

An Apache-incubated agent workspace that treats every model call, tool run, and permission decision as an append-only, replayable event log instead of disposable chat history.

View details
82
Repo Health
85
Technical
73
Dependency
Built with
TypeScript 92%
Updated 6 days ago
TypeScript
88%
Apache 2.0

Medplum

Authentication · Databases · Developer Tools

2,760

An open-source, FHIR-native healthcare platform that gives developers a compliant backend, authentication, a React component library, and serverless bots to build clinical applications in weeks instead of years.

View details
93
Repo Health
90
Technical
71
Dependency
Built with
TypeScript 88%
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