Skip to content

Choose your setup

Install the smallest set of packages that gives you the output you need. Start with Core if SVG or terminal text is enough. Every other package builds on it.

Package Choose it for Outputs
@qrcodesdk/core Runtime-neutral generation and raw matrix access SVG string, terminal text string, QRCodeMatrix
@qrcodesdk/browser Direct DOM output and client-side downloads HTMLCanvasElement, PNG, WebP, GIF, or JPEG HTMLImageElement, SVG or image download
@qrcodesdk/node Server-side raster output PNG, WebP, GIF, or JPEG Buffer
@qrcodesdk/react React and Next.js components QRCodeSVG, QRCodePNG, QRCodeWebP, QRCodeGIF, QRCodeJPEG, QRCodeCanvas, downloads
@qrcodesdk/react-native React Native and Expo components QRCodeSVG, QRCodePNG, QRCodeWebP, QRCodeGIF, QRCodeJPEG
@qrcodesdk/vue Vue components QRCodeSVG, QRCodePNG, QRCodeWebP, QRCodeGIF, QRCodeJPEG, QRCodeCanvas, downloads
@qrcodesdk/svelte Svelte components QRCodeSVG, QRCodePNG, QRCodeWebP, QRCodeGIF, QRCodeJPEG, QRCodeCanvas, downloads
@qrcodesdk/angular Standalone Angular components QRCodeSVG, QRCodePNG, QRCodeWebP, QRCodeGIF, QRCodeJPEG, QRCodeCanvas, downloads
@qrcodesdk/cli Terminal, shell, and CI workflows Terminal text, SVG, PNG, WebP, GIF, or JPEG file

For SVG, terminal text, or raw matrix output.

Terminal window
npm install @qrcodesdk/core

For Canvas elements, PNG, WebP, GIF, and JPEG Image elements, and browser downloads.

Terminal window
npm install @qrcodesdk/core @qrcodesdk/browser

Install Node.js PNG, WebP, GIF, and JPEG output

Section titled “Install Node.js PNG, WebP, GIF, and JPEG output”

Requires Node.js 22.0.0 or newer.

Terminal window
npm install @qrcodesdk/core @qrcodesdk/node
Terminal window
npm install @qrcodesdk/react

React and React DOM are peer dependencies. Keep the versions your app already uses.

Next.js Server Components that import style factories also need Core as a direct dependency. See Add Core to a framework project and Next.js client boundary.

Terminal window
npm install @qrcodesdk/react-native react-native-svg

React Native 0.79 or newer, React, and react-native-svg are peer dependencies. In an Expo app, install react-native-svg with npx expo install react-native-svg.

Terminal window
npm install @qrcodesdk/vue

Vue 3 is a peer dependency. Keep the version your app already uses.

Terminal window
npm install @qrcodesdk/svelte

Svelte 5 is a peer dependency. Keep the version your app already uses.

Terminal window
npm install @qrcodesdk/angular

@angular/core and @angular/common are peer dependencies. Angular 20, 21, and 22 are supported. Keep the versions your app already uses.

Requires Node.js 22.12.0 or newer.

Terminal window
npm install -g @qrcodesdk/cli

Yarn 2 and newer have no global install. Add the CLI to a project or run it with yarn dlx. See Install on the CLI page.

The React, React Native, Vue, Svelte, and Angular packages depend on Core. They re-export:

  • shape and center-image factories
  • automaticSegmenter and the kanji table
  • microQR() and rMQR()
  • the payload helpers, such as wifiPayload()
  • types

They do not re-export qrcode() or QRCodeError. Add Core as a direct dependency when you need those, or when Next.js Server Components import style factories from @qrcodesdk/core/style. Your app can only import packages it declares.

Install the same Core version your framework package uses:

  1. Run npm ls @qrcodesdk/core or pnpm why @qrcodesdk/core. Note the version listed under your framework package, such as @qrcodesdk/react.
  2. Install exactly that version with npm install --save-exact @qrcodesdk/core@<version> or pnpm add --save-exact @qrcodesdk/core@<version>.
  3. Run the first command again. It should list a single Core version.

Repeat these steps whenever you upgrade the framework package.

Matching versions keep a single copy of Core installed. With two copies:

  • shapes from one copy can draw incorrectly in the other,
  • renderers ignore center images created by the other copy,
  • instanceof QRCodeError fails.

Every QRCodeSDK package is ES modules only. There is no CommonJS build.

Your code How to load QRCodeSDK
ES modules, TypeScript, bundlers import
CommonJS on Node.js 22.12 or newer require() or dynamic import()
CommonJS on older Node.js Dynamic import(); require() throws ERR_REQUIRE_ESM

A dynamic import() works in CommonJS on every supported Node.js version:

// CommonJS module, such as index.cjs
async function main() {
const {QRCodeSVGRenderer, qrcode} = await import('@qrcodesdk/core');
console.log(qrcode('https://qrcodesdk.dev').render(QRCodeSVGRenderer()));
}
main();

TypeScript with module: 'commonjs' rewrites import() to require(). Use module: 'node16' or 'nodenext' to keep the dynamic import. See Core runtime compatibility.

Support QRCodeSDK

If you find QRCodeSDK useful, please consider sponsoring the project!