Developers & agents
Self-hosting a QR generator
Self-hosting a QR generator buys two things no hosted service can promise: a provable privacy boundary and permanence on your own terms. UseQR is MIT-licensed — clone github.com/rajkaria/useqr, pnpm install, pnpm verify, and deploy the Next.js app anywhere Node runs; the whole surface, API and MCP server included, comes with it.
What self-hosting actually buys
Two guarantees, and only self-hosting provides either in provable form:
Privacy you can audit. A hosted generator asks you to trust a privacy policy. Your own instance replaces trust with a network tab: when the code runs on your infrastructure — or fully client-side, as UseQR's static generation does — WiFi passwords, payment details and vCards demonstrably never cross a boundary you do not control. For regulated environments, that is the difference between a compliance conversation and a compliance document.
Permanence on your terms. Free web services die; paid ones get acquired and sunset. Static QR codes survive their generator, but the tooling — your templates, your bulk workflows, your API integrations — does not, unless you hold the code. What happens when a QR service shuts down is the full argument; self-hosting is its strongest answer, and it is why an MIT licence is a feature, not a footnote.
What it does not buy: dynamic QR codes. Editable destinations and scan analytics need a persistent redirect service with uptime obligations — a different, heavier project. If you need those, weigh a paid platform honestly.
Self-hosting UseQR
Everything at useqr.app — generator UI with all 32 payload types, the keyless API, decode and verify endpoints, batch, the MCP server, the scanner and validator — is one MIT-licensed monorepo. There is no cloud half, no feature flag between the public instance and yours.
git clone https://github.com/rajkaria/useqr
cd useqr
pnpm install
pnpm verify # lint + typecheck + test + build
pnpm --filter @useqr/web dev # local instance
pnpm verify is worth running before you deploy: the test suite includes the
render → decode round trips, so a green build means your instance provably produces
codes that scan. The repo is two packages — @useqr/core (matrix, styled SVG
renderer, typed payload builders, the decode-verify loop) and the Next.js web app.
The canonical origin is configuration rather than code — set the environment
variables described in the repo's deploy documentation and every generated URL,
sitemap entry and API self-reference follows your domain.
Deployment is standard Next.js: the reference instance runs on Vercel, and anywhere that runs a Node server (or an equivalent platform adapter) works. The API routes that rasterise PNGs use a native renderer, so match your build platform to your runtime platform — the usual serverless native-binary caveat.
Lighter-weight alternatives
Self-hosting a full toolkit is not always the right size. Honest options down the ladder:
- A library, in-process. If one service needs codes,
npm ia generator library and skip the HTTP hop entirely. - QuickChart, open source, if you want a small single-purpose image service and no UI.
qrencodeon a box for shell-driven internal tooling.
And the zero-effort rung: static generation on the public UseQR instance already runs client-side in your browser, which covers the privacy requirement for individual use without hosting anything.
Operating notes
Set long-lived immutable caching on generated images (the strategy) and a CDN in front if the instance is public — deterministic output makes your origin traffic approach one render per unique code. Track the upstream repo for decoder and payload spec updates; payment formats like PIX and UPI evolve, and a stale payload builder fails at the bank, not in your logs.
FAQ
Why self-host a QR code generator?
Two reasons stand up: a provable privacy boundary for sensitive payloads, and permanence — your tooling cannot be sunset, paywalled or acquired out from under you. If neither applies, a keyless hosted API is less work.
Is UseQR really fully open source?
Yes — MIT, at github.com/rajkaria/useqr. The public instance and a self-hosted clone run the same code: generator UI, REST API, decode and verify endpoints, batch, MCP server and scanner. There is no proprietary tier.
What do I need to run UseQR myself?
Node and pnpm to build (pnpm install, pnpm verify), then any host that runs a Next.js app. Configure the canonical origin via environment variables so generated URLs point at your domain, and match build and runtime platforms for the native PNG rasteriser.
Does self-hosting give me dynamic QR codes?
No. UseQR generates static codes, self-hosted or not. Editable destinations and scan analytics require a persistent redirect service — either build that as its own project or use a dynamic QR platform and accept the dependency.
Try it — free, no signup
Related
- A free QR code API with no key — UseQR's REST API needs no signup, no API key and no SDK. GET /api/v1/qr?data=hello returns a PNG. The shortest form is /q/hello.png, which drops straight…
- QR codes in serverless functions — Generating QR codes in Lambda, Cloudflare Workers and Vercel functions — bundle size, native dependency pitfalls, streaming, and when to skip the function entirely.
- QR codes from an AI agent: the UseQR MCP server — UseQR runs a keyless MCP server over Streamable HTTP at /api/mcp. One command adds it to Claude; a few lines of JSON add it to Cursor or Copilot. Agents…
- Caching and CDN strategy for QR images — QR codes are pure functions of their parameters, so cache them forever: immutable Cache-Control, hash-keyed storage, CDN edge caching, and why cache-busting is wrong.