Stripe, a streaming AI support assistant
Claude answers stream in over SSE, so no one stares at a spinner
SSE
Answers stream as they’re written
6
Explicit stream states
[you]
Outcome you’re cleared to share
01
Overview
The problem
[One sentence a non-Stripe reader understands, e.g. support answers about payments had to be fast and correct.]
What I built
A support assistant that streams Claude's answer over Server-Sent Events, so people see progress immediately instead of waiting for a full response.
My role
[Design and front-end engineering? Who else was on the team (roles, not names)?]
02
Designing for latency
User → support UI (React) → backend → Claude API, with the answer streamed back over SSE.
Time to first token is what users feel: show something within ~300 ms, then stream text as it arrives.
- Render deltas in batches, once per animation frame, so long answers don't jank the UI
- Give users control: a stop button, retry on failure, and keep the partial answer if the stream drops
- Never leave a blank state: skeleton → status → streaming text → done, and a calm error that keeps what was shown
Financial data, principles not controls
- Send the model only what the answer needs; redact identifiers in the UI and logs
- A person confirms anything that changes money or account state
- Sanitize rendered model output
[Which of these you owned vs. which a platform team provided.]
03
Accessible streaming
- Announce politely (aria-live) in sentence-sized chunks, not every token, so screen readers don't read fragments
- After sending, focus stays in the composer; the stop button is keyboard-reachable; "Answer complete" is announced once
- No typing-cursor animation when reduced motion is set
[The components or tokens you used or added, generic names only.]
04
Engineering
Pattern written fresh for this portfolio, not Stripe code. A small state machine keeps the streaming UI predictable: every element reads one status, so "streaming" and "error" can never be true at once.
type StreamState =
| { status: 'idle' }
| { status: 'connecting' }
| { status: 'streaming'; text: string }
| { status: 'done'; text: string }
| { status: 'stopped'; text: string }
| { status: 'error'; text: string; message: string }Tested with Jest by feeding the reducer scripted event sequences, and mocking fetch with a ReadableStream that splits one SSE frame across two chunks, the classic parsing bug.
05
Paths not taken
WebSockets vs. SSE
SSE is one-way over plain HTTP and fits "server streams an answer"; WebSockets add connection management for no gain.
Full response vs. streaming
Simpler to build and test, but users stare at a spinner for several seconds.
Per-token vs. per-frame render
The first version is easy and janky on long answers.
[Keep only the ones you actually considered.]
06
Impact
[Outcome metrics you're cleared to share, or the qualitative impact.]
07
What's next
[What you'd build in v2, e.g. answer citations, confidence signals, smoother escalation to a human.]
