← All work

Offline-first qualification platform for field sales

JSON-schema-driven PWA forms that field sales executives fill in with or without a network, with a shared form module shipped as an npm package and loaded via Module Federation.

Status
Shipped
Role
[FILL: e.g. Frontend lead for the form module and offline sync]
Period
[FILL: 2023 – present]

Problem

Field sales executives qualify leads on site. Coverage is patchy, so a form that needs the network loses data or wastes the visit.

The forms also change often. Hard-coding each one in React meant a release for every new question.

Scale: [FILL: users, number of forms, number of teams consuming the module].

My role

[FILL: what you owned end to end, who you worked with (e.g. 1 backend engineer, 1 PM), and what you did not own. Interviewers will probe the boundary.]

Architecture

Form definitions are JSON schema; one shared renderer is consumed by host apps through Module Federation; submissions queue locally and sync when online.AUTHORING: Form definitions. Then SHARED MODULE: Form renderer. Then FIELD DEVICE (PWA): Host app shell, Local store. Then SYNC: Sync queue. Then BACKEND: [FILL: API].AUTHORINGForm definitionsJSON schemaSHARED MODULEForm renderernpm + Module FederationFIELD DEVICE (PWA)Host app shellservice workerLocal store[FILL: IndexedDB?]SYNCSync queue[FILL: conflict rule]BACKEND[FILL: API]
Form definitions are JSON schema; one shared renderer is consumed by host apps through Module Federation; submissions queue locally and sync when online.
  • Forms are data. Each form is a JSON schema plus UI hints, so adding a question is a content change, not a deploy.
  • One renderer, many hosts. The form module is published to npm for build-time consumers and exposed as a Module Federation remote for apps that load it at runtime.
  • Writes go local first. A submission is persisted on the device, then a sync queue pushes it when the network returns.

Key decisions and trade-offs

Decomposing the JSON schema

[FILL: how you split large schemas (per section? per step? shared fragments with $ref?), what that bought you (smaller payloads, reuse across forms, partial validation per step) and what it cost (resolution complexity, versioning of fragments).]

SurveyJS vs building in-house

Option For Against
SurveyJS [FILL] [FILL]
In-house renderer [FILL] [FILL]

Decision: [FILL: which one and the single deciding factor. Be ready to say what would make you choose the other option today.]

npm package and Module Federation

[FILL: why both. Typical answer: npm gives versioned, type-checked builds; Module Federation lets host apps pick up a fix without redeploying. What broke? Shared React singletons and version skew between host and remote are the usual pain points.]

Sync conflicts

[FILL: the rule. Last-write-wins per record? Per field? Server-authoritative with a client merge prompt? How do you detect a conflict: version number, updated-at, hash? What happens to a submission against a schema version that no longer exists?]

Hard bug I fixed

[FILL: one bug, told as symptom → how you narrowed it down → root cause → fix → what you changed so it can’t recur. Offline apps usually give you a good one: stale service worker serving an old form schema, duplicate submissions on retry, or IndexedDB quota on low-end Android.]

Outcome / status

[FILL: confirm it is in production, and since when.] [FILL: metric, e.g. forms shipped without a frontend release, submissions captured offline, teams consuming the shared module. Only numbers you can source.]

Stack

  • React
  • TypeScript
  • PWA
  • Service Worker
  • JSON Schema
  • Module Federation
  • npm packages