Next.js package

next-qr

QR codes for your Next.js dev server

Print LAN URLs and scannable terminal QR codes for local Next.js development so phones and tablets on the same network can open your app instantly.

Wraps `next.config.*`
Prints LAN URLs automatically
Scan on phones and tablets
npm install -D next-qrNext.js 12+MIT License
next.config.ts
code
import withQRCode from "next-qr"
const nextConfig = {
reactStrictMode: true,
}
export default withQRCode(nextConfig)
terminal output
terminal
$ npm run dev
✓ Starting...
✓ Ready in 2.5s
Visit your Next.js app on mobile:
http://192.168.0.14:3000
█▀▀▀▀▀█ ▄▄▄▄ ▄▀█ █▀▀▀▀▀█
▀▀ █ █▀▄█ █▄▄█▄▀▀▄▀▀▄█
server reachable

The Problem

Mobile testing should not start with copying local IP addresses

Without next-qr

Find the right LAN IP, port, and path every time you switch devices.

Type long local URLs manually on a phone, or paste them through chat.

Repeat the process whenever the port or active network changes.

Lose time before you even start checking the responsive UI.

$ next dev
Local: http://localhost:3000
Network: http://192.168.0.14:3000
// now copy this into a phone somehow

With next-qr

Wrap your `next.config.*` once and keep route files untouched.

Print QR codes when the dev server is reachable on the local network.

Prefer the interface you want, or filter hosts and URLs explicitly.

Keep mobile QA focused on the app instead of environment setup.

Use the same package across Pages Router and App Router projects.

$ npm run dev
Visit your Next.js app on mobile:
http://192.168.0.14:3000
QR printed in terminal
Scan and open on your device

Features

Built for the real shape of local Next.js development

Terminal-first QR output

Prints LAN URLs and QR codes directly where you already run `next dev`.

Config-level integration

Works through `next.config.*`, so App Router and Pages Router projects use the same setup.

Bundler-aware behavior

Detects Webpack and Turbopack automatically, with explicit override support when you need it.

Network targeting controls

Tune `hostFamily`, include or exclude raw hosts, set a preferred interface, and append custom paths.

Useful filtering hooks

Use `filter` and `logger` options when you want custom output rules or custom logging.

Smart defaults

Defaults to `once: true`, `protocol: "http"`, `hostFamily: "ipv4"`, and port fallback from args, `PORT`, then `3000`.

CLI setup helpers

`next-qr init` injects `withQRCode`, and `next-qr doctor` verifies the project wiring.

Utility exports included

Use `printQRCodes`, `getLocalNetworkUrls`, or `getPreferredNetworkUrl` in your own tooling.

Config Surface

Quick start, CLI helpers, runtime options, and exported APIs

next-qr stays small on purpose: one wrapper, a few CLI commands, focused options, and utilities you can reuse in your own dev tooling.

next-qr reference
The parts you actually configure or call.
`next >= 12` is required.
next.config.ts
code
import withQRCode from "next-qr"
export default withQRCode(
{
reactStrictMode: true,
},
{
preferInterface: "en0",
path: "/preview",
}
)

JavaScript configs work too. The package exposes both ESM and CommonJS entry points.

next-qr init

Injects `withQRCode` into the detected app config and installs the package if needed.

next-qr doctor

Checks for a supported Next.js project, installed package, config file, and wrapper usage.

Runs only in development; production builds and starts are ignored.
Port resolution order is explicit `port`, CLI arg, `process.env.PORT`, then `3000`.
The default network family is `ipv4`.
Link-local addresses are skipped so the output stays usable on real local networks.
bundler

`auto`, `webpack`, or `turbopack`.

enabled

Disable output without removing the wrapper.

port

Override port resolution when you need a fixed value.

path

Append a path such as `/preview` to generated URLs.

protocol

Switch to `https` for unusual local HTTPS setups.

once

Defaults to `true`; repeated output is mainly a Webpack-mode concern.

filter

Decide which generated URLs should actually be printed.

logger

Send output through a custom logger object.

hostFamily

Choose `ipv4`, `ipv6`, or `all`.

includeHosts

Whitelist raw interface addresses before URLs are built.

excludeHosts

Blacklist raw interface addresses before URLs are built.

preferInterface

Move one network interface to the top of the list.

startupDelay

Delay port checks in Turbopack mode.

startupTimeout

Stop waiting if Turbopack never becomes reachable.

Auto mode prefers Turbopack when `--turbopack`, `--turbo`, `nextConfig.turbopack`, or Next.js 16+ suggest it.
Auto mode prefers Webpack when `--webpack` is present or the config already defines `webpack(...)`.
Turbopack mode waits for the server port, then prints once when the app becomes reachable.
Serializable Turbopack options can use a detached watcher; function options such as `filter` and `logger` use an in-process watcher.
withQRCode(nextConfig, options?)

Wrap a Next.js config and enable QR printing in development.

new NextQRCodePlugin(options?)

Use the plugin directly when you manage Webpack plugins yourself.

printQRCodes(port, options?)

Print URLs and QR codes immediately, returning the generated URLs.

getLocalNetworkUrls(port, options?)

Return LAN URLs without printing anything.

getPreferredNetworkUrl(port, options?)

Return the first URL after interface preference ordering, or `null`.

Ready to scan your dev server?

Install next-qr, wrap your config once, and open your local app on mobile in seconds.

npm install -D next-qrView on npm
next-qrBuilt by Toufiq Hasan KironNext.js 12+
MIT LicenseGitHub