Web Development

I Built a Private Health App in the Browser, And I'm Actually Impressed It Works

A

Adil Sher

Author

Aug 24, 2026
5 min read
0 views
I Built a Private Health App in the Browser, And I'm Actually Impressed It Works

A few months ago, a friend asked me to help build a health logging app for his startup. My first instinct? Spin up a Node backend, throw it on AWS, use some managed LLM API. Standard playbook. Then he mentioned the regulatory requirements, the compliance overhead, and the fact that users would rather die than send their medication logs to another cloud provider. That conversation haunted me until I stumbled onto WebLLM and WebGPU.

I'm going to be honest: I was skeptical. Running a real language model, not some tiny distilled thing, but actual Llama-3, entirely in the browser sounded like a demo that would collapse under any real load. But after actually building it, I've changed my mind. This isn't just a cute proof of concept. For specific use cases (particularly healthcare), this is production-viable, and it solves problems that cloud-first approaches simply can't.

The Problem We're Actually Solving

The healthcare space has a trust deficit. Every time a user submits health data to a third-party service, there's a transaction cost, not just in computation, but in privacy exposure. HIPAA compliance, data processing agreements, the fear that your logs might end up in some training dataset. These aren't paranoid concerns; they're legitimate business risks that most startups haven't figured out how to handle elegantly.

The traditional approach is to build your own secure backend, encrypt everything in transit and at rest, hire a compliance officer. This is expensive and creates a centralized target. What if instead, we moved the entire computation to the user's device?

That's where WebLLM comes in. It's a TypeScript library that lets you run quantized LLMs directly in the browser using WebGPU, essentially hardware-accelerated ML without leaving the user's GPU. Combined with Transformers.js for lightweight feature extraction, you get a genuinely private stack.

How This Actually Works

The architecture is elegant. Your health log never touches your backend. Instead, the user's browser downloads the model weights (this happens once), and then inference runs locally on their GPU. The browser becomes a compute node. No API calls. No network requests containing sensitive data. The only thing that leaves the device is whatever the user explicitly chooses to send.

Here's what the flow looks like in practice:

// Initialize the WebLLM engine once
const engine = new webllm.MLCEngine();
await engine.reload("Llama-3-8B-Instruct-q4f16_1-MLC");

// When the user submits their health log, everything happens locally
const messages = [
 { 
 role: "system", 
 content: "Analyze this health log for patterns. Be clinical and concise." 
 },
 { 
 role: "user", 
 content: userHealthLog 
 }
];

// This runs on the user's GPU, not your servers
const response = await engine.chat.completions.create({ messages });
console.log(response.choices[0].message.content); // Clinical summary, generated locally

The model weights are pre-quantized to 4-bit precision, so an 8B parameter model fits comfortably in browser memory. Load times are measured in minutes on first run, then cached locally via IndexedDB. Subsequent inference is genuinely fast, we're talking sub-second latency on decent GPUs.

What This Means in Practice

I'm genuinely bullish on this for healthcare applications, but I'm also clear-eyed about the tradeoffs.

What works: Privacy-by-architecture. No cloud backend means no data exfiltration vector. Users get clinical insights without surrendering medical history. The latency is lower than cloud APIs after the initial model load. For a single user analyzing their own data, this is phenomenal.

What concerns me: Browser environment is unpredictable. Not all devices have WebGPU support (GPU requirements are strict, you need relatively recent hardware). Model updates require shipping new quantized weights. If your app needs cross-device synchronization or sophisticated aggregation, you still need a backend, and now you're managing both local and cloud logic.

The honest take? This isn't a replacement for traditional backends. It's a targeted solution for a specific problem: user-generated health data that doesn't need to leave the device. I'd use this for personal health tracking, symptom logging, medication reminders, anything that's inherently single-user and privacy-sensitive.

But if you're building a platform where doctors need to access patient data, or you're doing population-level analytics, you still need infrastructure. The question then becomes: how much of the sensitive processing can you defer to the client while keeping your backend lightweight?

The Question I'm Still Mulling

The one thing that keeps me up at night: model safety and hallucination. Llama-3 will confidently generate medical advice that sounds plausible but is completely wrong. Running locally doesn't magically solve prompt injection or adversarial inputs. In healthcare, that's not academic, it's dangerous. The article mentions this casually, but production implementations need serious guardrails: prompt engineering, output validation, clear disclaimers that this isn't a replacement for medical advice.

Are you building anything that needs to stay on the user's device? I'd genuinely like to know what you'd use this for and what your concerns are.

Source: This post was inspired by "Stop Sending Your Vitals to the Cloud: Running Llama-3 Locally in the Browser with WebLLM & WebGPU 🥑" by Dev.to. Read the original article

Written by Adil Sher

Full stack developer building high-traffic platforms, AI services, and custom web applications. Explore my portfolio, learn about my background, or get in touch.

Related Articles

Stop Cargo-Culting chmod 777 and Actually Understand Your Filesystem
Web Development Aug 23

Stop Cargo-Culting chmod 777 and Actually Understand Your Filesystem

I'll be honest: for the first three years of my career, I treated `chmod 777` like a magic incantation. Script won't run? Permissions broken? `chmod 777`, move on, ship it. I never questioned why I was doing it, just that it worked. Then I got burned in production, badly.

Linux Won, But Unix Still Pays My Rent: A Developer's Honest Take
Web Development Aug 22

Linux Won, But Unix Still Pays My Rent: A Developer's Honest Take

I spent three years working on infrastructure at a fintech company in Islamabad before it hit me, I'd never actually *chosen* between Linux and Unix. The choice had been made for me, embedded so deep in the ecosystem that questioning it felt like questioning gravity.