Work / Health-tech operations

A health-tech operations platform

A health-tech operations platform for kit registration, store and admin workflows, lab-status automation, and auditable transactional communication.

Connected

customer, store and admin workflows

Problem

A health-tech client needed an operational platform around health-test kits, not just a public website — and that's what I built with them. Customers had to register kits and follow test status. Stores needed to invite and support customers. Administrators needed to manage exceptions. Lab events had to flow back into the product, and notifications had to be timely without making every request depend on a fragile chain of third-party calls.

Constraints

Customer, store and administrator responsibilities needed distinct access. Lab events could arrive out of order or before a customer record existed. Sensitive communications needed an operator's judgment.

What I did

Domain model

The first engineering task was mapping the real process with the company’s operating team:

  • who touches a kit at each stage
  • which information is required before the next transition
  • which events originate at the lab
  • which events notify a customer, store, or administrator
  • which cases require review before communication

The core domain object is a test kit identified by a vial number. Around it sit customers, stores, users, media assets, status notes, lab events, notifications, and support exceptions.

The product has three distinct operational surfaces:

Surface

Responsibilities

Customer

Register kit, verify identity, track status, view results.

Store

Invite customers, create tests, view history, resend invitations, manage release readiness.

Admin

Manage stores and users, inspect tests and media, resolve exceptions, review status and notifications.

Treating store users as a thin version of customer accounts would have produced incorrect ownership boundaries. Store access required organization-style membership, role checks, and store-scoped data access.

Architecture

The Cloudflare-first TypeScript stack kept the operational surface small while providing distinct homes for relational state, media, and asynchronous work.

Layer

Choice

Responsibility

Web application

Next.js on Cloudflare Pages

Public registration, customer, store, and admin interfaces.

API

Hono Workers with tRPC

Typed procedures, webhooks, uploads, and request validation.

Relational state

D1 with Drizzle

Customers, stores, tests, status, notifications, and audit data.

Media

R2

Vial images and public media assets.

Background work

Queues

Lab pushes, invitations, transactional email, and retryable side effects.

Authentication

Clerk

Identity, verification, invitations, and organization-style ownership.

Email

Resend with React Email

Typed transactional templates and delivery status.

The monorepo separated the web application, API, worker, database schema, transactional templates, auth, shared types, UI, and integrations. That kept the UI independent from lab processing and kept the worker independent from form rendering.

Asynchronous notification delivery

Email is part of the operational workflow, so delivery needs an audit trail. Product events enqueue jobs rather than sending most messages inside the request path:

product event
  -> Cloudflare Queue message
  -> worker job
  -> React Email template
  -> Resend send or draft
  -> D1 notification record
  -> Resend webhook updates delivery status

The record captures recipient, provider, message metadata, and delivery state. Retrying a job is safer than retrying an opaque browser request.

Sensitive cases use a reviewed draft. Lost-sample and sample-error flows can alert support and create customer-facing communication for an operator to approve. Automation removes repetition; it does not remove judgment from sensitive messages.

Lab event processing

The lab webhook is intentionally thin. It validates the incoming event and enqueues it. A worker resolves the current vial status, finds the matching test, updates the lifecycle, and triggers the appropriate follow-up.

The design protects terminal states and accounts for out-of-order operations. A late webhook must not move a released test backwards. An event that arrives before the customer record exists should become an inspectable holding case rather than disappearing into logs.

Result

Underneath the dashboards, this was really an operational reliability project. The system ended up with typed application boundaries, durable workflow state, asynchronous integration processing, auditable communication, and enough administrative surface for the business to handle its normal exceptions without pulling in an engineer.

The delivered system connected customer, store and administrator workflows. No clinical outcome or financial impact is claimed here.

Tradeoffs

Asynchronous processing makes integration failures inspectable but requires durable lifecycle state, retry handling and administrative tools. Operator review remains part of sensitive communication workflows.

Stack

Next.jsCloudflare PagesCloudflare WorkersCloudflare QueuesD1R2HonotRPCDrizzleClerkResend

Explore more problems I've solved

Bhavin Kamani

A small command line for a curious visitor.