cat projects/wifi-qr-generator/README.md
Wi-Fi QR Generator
Make a QR code for a link, text or a Wi-Fi network, with an optional centre logo and a printable guest card. Everything runs in the browser: nothing is sent or stored.
- Role
- Designer and developer
- Layers
- L2 · BUILD Software DevelopmentL3 · RUN IT Support & Systems Administration
Problem
Sharing Wi-Fi with guests usually means reading out a long password, and most online QR tools upload what you type, including network passwords, to someone else’s server.
Constraints
- No server involvement at all: a Wi-Fi password must never leave the visitor's device.
- The site's strict Content Security Policy forbids data: and blob: images.
- The library had to be maintained; the original one hadn't been updated in years.
Approach
A browser-only tool: the code is built from the text you type and drawn on a canvas, with no server call and no storage. Wi-Fi mode builds the standard network string with special characters escaped. Logos use the highest error correction and are capped in size so the code still scans.
- Encoding: a maintained QR library set to UTF-8, so non-English network names encode correctly.
- Wi-Fi payload: the standard format with backslash, semicolon, comma, colon and quote escaped.
- Logo: read locally in the browser, error correction raised to the highest level, logo capped at a fifth of the width with a quiet margin.
- Output: drawn on a canvas, downloadable as PNG or SVG, plus a print layout for a guest card (password shown only if you choose).
Decisions
- Canvas instead of image URLs. It works within the security policy without weakening it for one page.
- Test by scanning, not by looking. Automated tests decode the generated codes with a QR reader, including every special character and the largest logo.
What went wrong
- The preview was always one change behind. It rendered from a delayed timer instead of the current input. Fix: render directly from the current state.
- The preview went blank after navigating in from another page. A security exception scoped to this page didn't apply after client-side navigation. Fix: canvas drawing, so no exception is needed, and browser tests that arrive via the menu.
Outcome
Codes that scan with any phone camera, including network names with special or non-English characters, downloadable as PNG or SVG, plus a printable guest Wi-Fi card. No password ever leaves the device.
Stack
TypeScript · React · Canvas API · a maintained QR library · Playwright tests with a QR decoder