
A Whole Building in a Browser Tab
A browser-native BIM platform: heavy IFC building models converted on the server, so anyone can click a wall in the browser and read the exact engineering data behind it. No install, no plugin, no license.
A showroom tablet that keeps selling when the internet quits

This looked like a website. It was really an appliance. The whole job lived in that gap.
| Constraint | Decision in this build | What I traded away |
|---|---|---|
| Connectivity can disappear mid-demo | Cache content locally and queue enquiries | First-time setup and cache readiness need explicit checks |
| A budget tablet has limited rendering headroom | Reduce media weight and stream brochure pages | More preparation and a device-specific performance budget |
| A production decoder must work offline | Serve the PDF image decoders locally | Decoder files become part of the release and cache plan |
Read the architecture section for the implementation, the readiness section for a reusable rehearsal, and the final section for the gaps I would address next. The media figures below are project measurements from the original build notes, not a fresh benchmark of the current portfolio.
For a smaller exercise in the same habit, try the runnable interaction examples. They show how to turn a promise like “retries are harmless” into an assertion you can actually run.
Garden Silk Mills is a real manufacturer with a real problem that has nothing to do with code. Their sales team stands on a booth floor. A buyer walks up. They have maybe ninety seconds to show who the company is, play a film about the mill, flip through a product brochure, and get a phone number before the buyer drifts to the next stall.
The old tool was a MERN kiosk: a React front end, an Express back end, a Mongo database. It worked on a desk with a cable. On a booth floor, over a phone hotspot, it stalled. And a stalled kiosk on a trade-show floor is worse than no kiosk, because now the salesperson is apologizing to a screen instead of talking to a buyer.
They came to me to move it onto tablets and make it behave like an appliance. Turn it on, it works. Lose the signal, it still works. No IT person standing by.
I don't start a build until I can write down what "done" means in words a non-technical client would agree with. For this project, done meant five things:
Notice what is not on that list: clever animations for their own sake, a fancy CMS, a big database. The client needed a booth that keeps working. Every technical choice below is downstream of those five lines.
Here is the thing nobody tells you about kiosk work. The device is the whole brief.
The kiosk runs on a Lenovo Tab K10: a Helio P22T chip, a PowerVR GE8320 GPU, 4 GB of RAM, Android 11, and LTE for its only connection. That is a budget tablet, and it is the right choice for a client buying a dozen of them.
An entry-level GPU means a 3D page-flip is a real risk, not a freebie. 4 GB of RAM means I cannot hold ten high-res brochures in memory at once. And LTE in a metal-and-concrete exhibition hall is not "slow," it is "gone, then back, then gone."
That last distinction is the whole project. Design for "slow" and you build spinners. Design for "gone" and you build a service worker.
The easy path was to wrap the existing MERN app in a PWA shell and call it a day. I chose to rebuild it as a fresh Next.js 16 app instead, and kept the old codebase in the repo as read-only reference, never shipped.
Why throw away working code? Three honest reasons.
The MERN kiosk was a client-rendered app talking to an always-on server. That architecture assumes a network, and my whole job was to remove that assumption. Fighting a client-server app to behave offline is more work than building offline-first from the start.
Second, the old media lived inside the JavaScript bundle, with videos imported as modules. Fine for a small site, a disaster for a kiosk: it bloats the bundle and makes the service worker's job impossible. I needed media as plain files the worker could cache one by one.
Third, and I'll be honest about this one: I built the first version as a pixel-exact replica of the old kiosk, down to a typo in one of the legacy route names, spelled exactly the same so nothing downstream broke. That was deliberate de-risking. Match the known-good thing first, prove the new foundation works, then improve.
Rebuilding and redesigning in the same step is how you end up unable to tell which change broke what.
The trade: more upfront work, a throwaway first version, and a week where the new app looked identical to the old one with nothing to show for it visually. What I bought: a clean foundation where offline was the default, not a patch.
The one choice I want to defend out loud is rendering the content pages as Server Components.
Think of a Server Component like a kitchen that plates the dish before it leaves for the table. By the time the tablet receives a page, the food is already on the plate: static HTML, no loading state, nothing to fetch. That is exactly what a service worker wants to cache.
A client-rendered page is a plate of raw ingredients with a note that says "cook this once you find a stove," and on a dead connection there is no stove. It's the same reason I reach for the server by default, and the same one-language discipline that catches a kiosk bug at build time instead of at the booth.
Explore the connections · swipe or use arrow keys when focused
One online load warms every route into the cache. After that, the tablet serves itself.
A textile brand is judged on how it looks in the first three seconds, so the brief had a quiet, strict rule underneath it: every page must feel like the same object. The way you get that is not taste applied twelve times. It is a system applied once.
The brand purple is pinned as a single CSS variable that everything references: buttons, focus rings, eyebrow rules, the pill gradients. Change one line, the whole kiosk shifts. That's a design system earning its keep on a small build.
The part I'm proud of is the type. Instead of picking font sizes per page, I defined five type roles as Tailwind v4 custom utilities, every one using clamp() so it grows with the screen and never drops below a comfortable size:
This small reference example demonstrates the idea with invented class names and values, rather than the kiosk's production stylesheet:
.demo-title {
font-size: clamp(2rem, 1.4rem + 2vw, 3rem);
}
.demo-copy {
font-size: clamp(1rem, 0.95rem + 0.5vw, 1.3rem);
}A page uses its shared title role and doesn't need a separate pixel size for every viewport. The viewport decides. That's how twelve pages stay identical without me hand-tuning twelve times.
Then a single media query, guarded by max-height: 900px so it only touches short landscape screens, compacts the scale for the 10.3 inch kiosk shape so a content page fits without scrolling, and leaves tall desktop monitors on the big scale. One rule, aimed precisely at the device in the client's hand.
Two shared shells, PageShell and PageHeading, make drift impossible: a new page cannot look different by accident, because the frame is not the page author's decision to make.
This is the heart of the project. A kiosk that needs the internet is a kiosk that fails on the day it matters most.
Serwist ships with a sensible default: pages use NetworkFirst, ask the network, fall back to cache. For most sites that is correct. For a kiosk on stuttering LTE it was the single worst choice, and it took a real bug to see why. NetworkFirst waits on the network before serving the cache.
On a flaky connection that wait times out, and the fallback fired the offline screen. So the kiosk, mid-conversation, would flash "You're offline" for a second even though the page was sitting right there in the cache. The buyer already saw the error; the salesperson doesn't get that second back.
The fix was to invert the default. Four custom runtime rules, all StaleWhileRevalidate: serve the cached copy instantly, refresh it quietly in the background if the network happens to be up. The offline screen becomes a true last resort, not a symptom of a slow first byte.
Two more pieces make it whole. A CacheWarmer runs once on load, after the worker is active and while the tablet is still online, and quietly fetches all 19 routes, 120 milliseconds apart, re-running whenever the device reconnects. After one online load, the entire kiosk is on the device, not just the pages someone happened to tap.
And KioskAutoUpdate polls for a new service worker every 15 minutes and silently reloads when one takes control, so I deploy a fix from my desk and the tablet updates itself within the quarter hour, with no clear-cache dance at the booth.
There's a trap hiding in video, too. A <video> element doesn't download a file in one go, it sends byte-range requests, and those partial responses come back as HTTP 206, which the service worker Cache API cannot store with Cache.put(). So a video could play perfectly online and be completely absent from the cache. Unplug the network and it's gone.
A small cacheMedia function fixes it: the first time a video plays, it fires one normal full-file fetch in the background and stores the complete file, after which Serwist's range plugin slices the cached copy to answer every future request offline. Playback never notices. The cache just fills behind it.
For a similar kiosk, I would make readiness a checklist tied to an asset version: required routes available, required films fully downloaded, brochure usable, and a sample enquiry saved and reconciled after reconnecting. These are reusable acceptance criteria, not additional results measured for this project.
Start the rehearsal with a prepared device, then repeat with a fresh browser. Those are different tests. An app cannot serve assets offline that it never obtained. Interrupt preparation halfway through, fill storage deliberately, and check that the interface does not claim readiness after a failed download.
MDN's storage guide explains why a local queue can fail or be removed. An on-device CSV export helps only once it has been saved somewhere that survives the failure you are planning for. Keep unsent records visible to staff, confirm server receipt, and define how long personal details stay on the device.
The compression and device measurements elsewhere in this case study belong to this build and its test conditions. They are not a promise that every tablet can cache the same media library. The broader PWA guide explains how to turn this into a test plan for another deployment.
The kiosk exists to collect enquiries, so the lead form had to be the most stubborn part of the whole app. It has to work with the network on fire, and it does that in three layers.
The server layer is one API route that writes to two completely different places depending on where it's deployed. On Vercel the filesystem is read-only, so the lead goes into Neon serverless Postgres with one INSERT. On a local kiosk build there is no cloud, so it appends to a leads.xlsx workbook and mirrors to CSV.
One DATABASE_URL flips between them, and the form doesn't know which world it's in. The Excel path writes atomically, to a temp file then a rename, because a rename is atomic at the OS level, so the workbook is either the old one or the new one, never a half-written corrupt one.
The browser layer is the safety net for when the request never reaches the server at all.
Explore the connections · swipe or use arrow keys when focused
The implemented flow distinguishes rejected requests from network failures. A general-purpose queue needs finer status handling.
That distinction is the careful bit. A network failure or a 5xx hiccup gets stored in localStorage with an honest message to the visitor ("Enquiry saved, it will be submitted automatically when back online"), and a LeadSync component flushes the queue on the browser's online event. The original flow does not queue 4xx responses.
That is a limitation to revisit when adapting it: authentication expiry, rate limits and state conflicts need different recovery paths from invalid form input.
The third layer is a hidden /export-leads page where event staff can download a CSV of everything captured on that tablet and push any unsynced leads by hand. If the entire cloud were down for the whole event, the leads are still recoverable from the tablet in the salesperson's hand. Belt, suspenders, and a spare belt.
Illustrative TypeScript, written for this article. This is a proposed teaching model with finer failure handling than the original kiosk’s blanket 4xx rejection. It is not extracted from the kiosk source.
type DeliveryAction = "saved" | "retry" | "sign-in" | "review";
function deliveryAction(status: number | null): DeliveryAction {
if (status === null) return "retry"; // no HTTP response
if (status >= 200 && status < 300) return "saved";
if (status === 401 || status === 403) return "sign-in";
if (status === 429 || status >= 500) return "retry";
return "review";
}
console.log(deliveryAction(503)); // retry
console.log(deliveryAction(422)); // review: fix the inputA failed connection and an invalid phone number should not get the same recovery plan. Retrying a typo faster is still a typo.
Here, saved assumes this API only acknowledges a durable save with 2xx. Other APIs may use 202 to mean “accepted for processing”; check that contract before clearing a queue. A 403 can require permission changes rather than another sign-in. The label means stop automatic delivery and ask for intervention.
A complete queue also needs durable local storage, an idempotent server operation, bounded backoff, Retry-After handling, and visible unsent records. MDN’s Fetch guide explains why HTTP errors need an explicit status check. IndexedDB is one option for structured browser storage; it still needs a failure and eviction plan.
The raw material was 2.9 GB of video plus print-resolution TIFFs. You cannot ship that to a 4 GB tablet on LTE, so before a single page was styled, the media had to be tamed.
One idempotent transcode-media.sh script does the whole job with ffmpeg and ImageMagick. Videos re-encode to H.264, capped at 1080p, CRF 23, with +faststart so playback begins before the file finishes downloading. One clip went from 434 MB to about 90 MB.
The TIFFs from the print team were the shock: one saree image was a 282 MB TIFF, and re-encoded to JPEG and WebP it landed at about 520 KB. That's not a typo. Print files carry data a screen will never show.
The whole 2.9 GB became 762 MB, served from a Cloudflare R2 bucket in production and a local folder for offline builds, switched by one environment variable, with the service worker treating R2 URLs exactly like same-origin ones.
The brochure needed to feel like a physical look-book, pages turning, not a PDF viewer with Next and Previous buttons. I started with an off-the-shelf library and threw it out, because it flipped flat rectangles like sliding cards. A real page bends and curls and catches the light along the fold. So I built the flip-book from scratch in three.js.
Each sheet is a 3D box rigged like a spine: split into 26 segments with one bone per segment, so when the page turns the bones rotate in a slight wave and the paper bends across its width instead of pivoting like a stiff door.
Frame-rate-independent damping drives the motion, which matters enormously here, because it means the turn feels identical whether the tablet runs at 60 frames a second or struggles at 30. On an entry-level GPU, that is the difference between elegant and janky.
The pages render from the brochure PDF client-side, streaming one at a time so the cover appears the instant it's ready.
Two of the most instructive bugs in the project live in this one component.
The first: the pages rendered black in production only. The brochures embed JPEG 2000 images, which pdf.js decodes with a separate WebAssembly module. In development the module resolved by accident through the build graph; in production it couldn't find the decoder, and every image rendered as a solid black box.
The kiosk looked perfect on my machine and broken on the tablet, the worst possible failure mode. The fix was one line, pointing pdf.js at a locally served copy of the decoders, locally because the kiosk must never depend on a CDN for something it needs offline.
The second: the first page turned the wrong way, swinging out and around instead of lifting cleanly. The cause was subtle. I was using an angle-aware damping helper that always takes the shortest wrapped path, but a page flips a full 180 degrees, and at exactly that midpoint the "shortest path" is ambiguous, so it resolved the wrong way.
Swapping to a plain damp on that one rotation, which drives the value directly without trying to be clever about wrapping, fixed it. Sometimes the helper that's smarter about the general case is exactly wrong for your specific one.
I'll keep this honest and hold it to the five lines I opened with.
The number I'd put on a portfolio: 2.9 GB of raw media compressed to 762 MB, and a kiosk that works with its network cable pulled.
Honesty is more useful than a clean win. Two changes.
I'd build first-boot cache warming from day one. Right now videos cache on first play, so a brand-new tablet needs one online session where someone taps through the films before it's fully armored. For a kiosk shipped to an event with no setup time, I'd rather warm the heavy media on the very first launch, in the background, before it ever reaches the floor.
And I'd put a build on the actual K10 on day one and keep it there. Too many of the tail-end bugs, the offline flash, the black images, the color shift, only surfaced on the real tablet, because a laptop's browser is too forgiving. "Works on my machine" is not a milestone on a kiosk project. "Works on their machine" is the only one.
| Layer | Choice | Why this one |
|---|---|---|
| Framework | Next.js 16, App Router, Turbopack | Server Components render to static HTML the service worker can cache flat, with no client fetch to fail offline |
| Language | TypeScript, strict | You cannot hotfix at the booth; a type error caught at build is a bug that never reaches the tablet |
| Styling | Tailwind CSS v4 | CSS-first config: the whole design system as variables and custom utilities, no JS config file |
| Offline | Serwist service worker | The engine: StaleWhileRevalidate everywhere, range-request video caching, a route warmer |
| 3D | three.js + react-three-fiber | The custom flip-book, with frame-rate-independent damping so it feels the same on any GPU |
| pdfjs-dist | Renders brochure pages to textures client-side, decoders served locally for offline | |
| Data | Neon Postgres / ExcelJS | Two backends for two deploy targets, flipped by one environment variable |
| Hosting | Vercel + Cloudflare R2 | App on the edge, heavy video on cheap object storage |
Constrained hardware, an environment that fails in ugly ways, and one person who can own the whole thing from media pipeline to deploy. Kiosk software looks like web development and is really appliance engineering wearing web clothes, and the craft is all in the failure modes.
If that's the shape of what you're building, tell me the constraint you're working inside and I'll tell you straight whether I'm the right person to build it.
Prabir Singh
Full-stack engineer in Mumbai. Twenty years in sales taught me why people buy; seven years of code taught me how to build what they'll pay for. I still read error messages the way I once read objections: as the most honest feedback of the day. More about me or start a project.

A browser-native BIM platform: heavy IFC building models converted on the server, so anyone can click a wall in the browser and read the exact engineering data behind it. No install, no plugin, no license.

A cybersecurity firm's whole web presence in one self-hosted Next.js codebase: marketing site, admin CMS, lead engine, and an AI chat desk