RPOMS Print Engine
Offline-first label printing workstation for the RPOMS refurbishment line
Offline-first browser workstation that drives a thermal Bluetooth printer with zero server latency on the production line.
A TypeScript and React Progressive Web App that turns any PC with Chrome and Bluetooth into a label station for a NIIMBOT B1 Pro. A USB scanner reads a router serial, a prefix-and-length rule names the model, a fixed 50 by 30 mm template is rendered to the printer's raster and printed over one persistent Web Bluetooth session. The print path never touches the network, the app boots offline from cache and IndexedDB, and a Node.js and PostgreSQL backend adds Google sign-in, device provisioning and sync. Deployed on a self-hosted Ubuntu server behind nginx, with a second module that prints QR device labels for the technology company's inventory system, ITMS, and a link through which RPOMS sends router labels to the running engine tab. My own independent project: 320 app tests and 42 backend tests.
Hardware Protocol Driver, Canvas 2D Renderer, Offline PWA & Backend
Key Highlights & Practical Impact
Executive Scan- Eliminated manual phone apps and spreadsheets with a single-scan-to-print browser workstation
- Deterministic model identification from barcode serial prefix and length without network calls
- Offline-by-construction PWA architecture booting and printing from service worker and IndexedDB
- Continuous Web Bluetooth session management eliminating paper rewind and feed jitter between labels
- Canvas-first template editor with automated raster hash freezing to guarantee physical label alignment
- Deployed and running on a self-hosted Ubuntu server (nginx, systemd, PostgreSQL) with Google sign-in, role-gated admin pages, sign-in rate limiting and an audit log
- A relay page lets another web application send a label to the open, connected workstation, which is how the technology company's ITMS prints device labels
- Rigorous verification: 218 app tests and 26 backend tests, a simulated printer, headless Chrome checks and PostgreSQL store tests in CI
Ready to explore the build?
A detailed look at the end-to-end architecture, process workflows, key engineering decisions, live production capabilities, challenges, and results.
Writing from this work
Google Sign-In Without a Client Library: Server-Side PKCE and Grants Read on Every Request
RPOMS added Google sign-in through its Supabase project's provider with no client library in the browser bundle. Google proves who someone is and grants nothing; a Super Admin grants access per service and capability, and revocation takes effect on the next request.
One Live Record per Router per Session: Partial Unique Indexes Instead of Per-Scan Locks
A barcode scanner can fire the same serial twice in a few milliseconds, and two workstations can scan the same router at once. RPOMS's Refining workstation catches both with one partial unique index, and decides whether to print from what the save recorded.
Sending Labels From One Web App to Another Tab: BroadcastChannel, COOP and window.opener
How RPOMS sends a router label to the Print Engine tab that holds the Bluetooth printer: why a hidden iframe could never work across sites, why one header had to be removed from one path, and what a lost answer must say.
The Service Worker Was Active and the Cache Was Empty: A Workbox Duplicate-Entry Bug
An offline PWA that registered its service worker, cached nothing, and failed silently. The cause was one file listed twice in the precache manifest by vite-plugin-pwa's includeAssets.
Vercel or a Self-Hosted Ubuntu Box? How I Chose Hosting App by App
Eight deployed apps, three hosting shapes: Vercel for pages and serverless APIs, a self-hosted Ubuntu box for a stateful API, and a hybrid for a model Vercel can't run.
Theme-Specific Logos Without a Flash: Let CSS Pick, Not useTheme()
A logo with an opaque white background became a white block on the dark theme. Swapping it in CSS on data-theme, not with useTheme(), fixed it on the first frame.
Testing Without Paid APIs or Hardware, and the Places Fakes Lied
Fake LLM providers, a simulated label printer and an in-process Postgres keep my test suites free and offline. What each proved, and three places a fake fell short.
Proving a PWA Boots Offline: A Headless Chrome Test Over the DevTools Protocol
An automated test that installs a PWA under production headers, cuts the network at the protocol level, reloads, and checks the app still works, with no test framework beyond a WebSocket.
Detecting a Device Model From Its Serial Number With Prefix Rules
How RPOMS and its print engine tell a router's model from its serial: prefix and length rules stored as data, longest prefix first, unknowns flagged.
Self-Hosting a Node and PostgreSQL Service With nginx and systemd on Ubuntu
The deployment behind print.rukon.dev: one origin for a PWA and API, a hardened systemd unit, atomic releases, nginx header gotchas and a backup design.
Security Headers for a Web Bluetooth PWA, Pinned by a Test
The CSP, Permissions-Policy and COOP for a PWA that drives a Bluetooth printer, why each source is there, a separate policy for the API, and a test that keeps nginx and the app in step.
A Written Conflict Policy for a Local-First Workstation App
How an offline-first PWA writes locally first, syncs on its own timer with backoff, and resolves conflicts with a rule per data type: last writer wins, server wins, append-only, never synced.
Where Does a 4-Second Label Go? Instrumenting a Scan-to-Print Pipeline
Stage-by-stage tracing of a Web Bluetooth label print, an audit of every sleep in the code, and the rule of not claiming a speed-up until the hardware has measured it.
Implemented, Available, Not Connected: Writing Honest Status Into Project Docs
"It exists in the repository" and "it runs in production" are different claims. The three-state status model I use across my projects, with real rows from each.
Google Sign-In for Shared Workstations: PKCE, Pending Users and Revocable Device Tokens
Google OIDC with PKCE on a framework-free Node server, users keyed by sub, accounts that start pending, and workstations provisioned with hashed, revocable device tokens that keep working offline.
Freezing a Label Design in CI by Hashing Its Rendered Raster
A Vitest test that hashes each label template's JSON and its exact 1-bit print raster, so any change that would move a single printed dot fails the build and the deploy.
Letting Another Web App Print Through an Open Tab: BroadcastChannel, Web Locks and COOP
How a tiny relay page lets another web application print on a Bluetooth printer held by an already-open tab, with one tab answering via a Web Lock and the printer's real result reported back.
Continuous Label Printing Without Duplicates: Page Counters and "Uncertain" Jobs
Why one printer job per label made the paper feed and rewind, how multi-page jobs fixed it, and how a print queue decides between a safe retry and a label that may already exist.
Chrome Throttled My Bluetooth Printer: Moving Timers Into a Web Worker
Labels slowed from about 4 seconds to 13 or more whenever the print tab was in the background. The cause was Chrome's timer throttling; the fix was a tiny Web Worker that owns the waits.
A Performance Gate That Stopped Crying Wolf: Medians and a Noise Floor
A baseline-versus-current benchmark flagged regressions on identical code. Medians of three runs and a rule that ignores tiny metrics made it a gate worth trusting.
Adding Label Printing to an Existing Next.js App Without Touching the Printer
The calling side of a print integration: validating SKUs the way the printer app will, passing them in a URL fragment, detecting blocked pop-ups, and refusing to print unsaved changes.
From Millimetres to Dots: Rasterising a 50×30 mm Label for a 576-Dot Printhead
How a label template in millimetres becomes a 1-bit raster for a 300 dpi thermal printhead: geometry, thresholding, whole-dot barcodes and why some designs cost more Bluetooth packets.
The NIIMBOT B1 Pro Bluetooth Protocol, Packet by Packet
The frame format, checksum, connect packet, identification reads and the full V4 print sequence I use to drive a NIIMBOT B1 Pro over Web Bluetooth, with what is verified and what is not.
Generating Barcode and Group SKUs in Excel From Spec Columns
How an Excel stock tracker built a per-brand serial that rolls past 99, a barcode SKU and a variant group key from spec columns with LET and TEXTJOIN, and where formula IDs break.
Printing Labels From the Browser Over Web Bluetooth: The RPOMS Print Engine
A scan-to-label workflow that drives a NIIMBOT B1 Pro directly from Chrome, with no vendor app and no backend. What the protocol work looked like, how 116 tests run without a printer, and what the first real print taught.