Skip to content
fa
Search Frontend Atlas
Search questions and concepts across the handbook.
Frontend System Designadvanced14 min read

How would you design a reliable multi-step checkout or onboarding flow?

Model workflow states, persistence, validation boundaries, retries, and recovery from partial completion.

A multi-step flow looks like a sequence of screens, but the user’s progress may outlive a component, a browser tab or even a device. Payment and onboarding flows also have consequences on the server that cannot be undone by moving the UI back one step. The design needs to distinguish temporary screen state from the authoritative workflow state.

A multi-step flow looks like a sequence of screens, but the user’s progress may outlive a component, a browser tab or even a device. Payment and onboarding flows also have consequences on the server that cannot be undone by moving the UI back one step. The design needs to distinguish temporary screen state from the authoritative workflow state.

The quick version

Represent the workflow as explicit steps and transitions, persist only what is safe and necessary, and let the server remain authoritative for committed business operations. Each transition needs validation and a recovery path.

Build the mental model

A browser flow is not a distributed transaction. Payment authorization, inventory reservation, and account creation may succeed independently. Use server-side workflow orchestration, idempotency keys, and compensating actions for cross-service failures.

See it in code

type Checkout =
  | { step: 'cart' }
  | { step: 'address'; cartId: string }
  | { step: 'payment'; orderDraftId: string }
  | { step: 'complete'; orderId: string };

Where it gets tricky

Persist durable server-side workflow identifiers, not just a client-side step number. A browser refresh should reconstruct the current authoritative state from the server. If payment succeeds but the response is lost, the client needs a way to query the operation by idempotency key or order ID rather than blindly submitting payment again.

A common misunderstanding

Persisting a client-side step does not prove the server completed that step.

What this changes in an application

Plan refresh/re-entry, duplicate submissions, expired sessions, back navigation, payment retries, and partial failures.

Questions worth exploring next

  • What belongs in the URL?
  • Which state must be server persisted

References and next steps

  • Saga pattern — primary or authoritative documentation for the underlying behavior.
  • MDN Web Docs — use the relevant API reference for adjacent browser details.