QR 0.3.14 · MIT · No runtime dependencies
QR codes that your application controls
Generate, render and read QR codes with one dependency-free TypeScript package. Add WebAssembly for faster decoding, or use plain JavaScript. Keep your camera interface, your pixels and your deployment under your control.
npm install @forgesworn/qr
import { encode, toSvg, decode } from '@forgesworn/qr'
const svg = toSvg(encode('https://example.com/'))
const result = decode(imageData) // RGBA or greyscale pixels
if (result) console.log(result.text)
Installation, recipes and API · Why choose QR? · Benchmarks and accuracy · GitHub · npm
Useful from the first import
- Make and read: versions 1–40, all four error-correction levels, text and bytes, optimal mixed segmentation, SVG, canvas and terminal rendering.
- Handle difficult frames: rotated, tilted, mirrored, inverted and damaged codes, with bounded recovery and checks against incorrect payloads.
- Scan successive frames: tracked camera sessions search the previous region first and recover through the full frame when needed. Every call reads fresh pixels; payloads are never cached.
- Choose your runtime: browsers, Web Workers and Node 22.13+, typed ESM, optional WASM through a separate import, JSR for Deno, a native Rust crate and Kotlin/JVM on Maven Central.
- Inspect and reproduce: MIT licence, no runtime dependencies, a detailed specification, shared vectors and public benchmark receipts.
The library does not open a camera, upload frames or require a hosted service. Your application supplies pixels and decides what to do with the result.
Accuracy is the priority
The recorded WASM comparison correctly reads 180 of 184 photographs, against ZXing-WASM's 171, and 172 of 224 synthetic stress frames, against 150. The latter set reports no wrong payloads and no false reads on 32 negative controls. These results describe the named datasets; they are not a guarantee for every image or device. Read the comparison and its limitations.
Pick the right tool
QR is a good fit for applications that need QR generation and pixel decoding without a runtime dependency tree or a prescribed UI. It reads ordinary QR Code Model 2, one result per call. Choose a broader barcode library if you need other symbologies, or a camera wrapper if you want a complete scanning interface.
Documentation and distribution
- Full API and integration recipes
- Choosing QR and comparing alternatives
- Specification
- Performance methodology and results
- Release notes
- Security reporting
- Distribution and release verification
- Native Rust crate and Rust API
- JSR package and Kotlin on Maven Central
- Concise machine-readable documentation
- Complete documentation as plain text