Part VI — The Blueprint · Lesson 11.14
HLD Kanban Board
In one lineDrag-and-drop with optimistic reordering — the design problem is what happens when the server says no.
Where you've seen itDropping a card into "Done" and having it snap back two seconds later because someone else already moved it.
Diagram
| Step 1–2 | Scope and scale |
|---|---|
| In scope | columns · cards · drag between and within columns · real-time sync · filters |
| Out of scope | reporting · automations · permissions admin |
| Scale | ~10 columns · up to 500 cards · 2–20 concurrent users |
6a · DEEP DIVE — ORDERING WITHOUT REWRITING EVERY CARD
✗ integer positions 1,2,3,4…
insert between 2 and 3 → renumber every card after it
→ 400 writes for one drag, and constant conflicts
✓ fractional / lexicographic keys
card A position "a"
card B position "n" insert between → "g"
card C position "z"
one write. Neighbours never change.
LexoRank / fractional indexing: always a value between
any two keys. Rebalance rarely, in the background.Lessons in this diagram2.4 Web Sockets
How it works
- Snapshot before the optimistic move, always — rollback is the feature, not the edge case.
- Fractional ordering keys so a drag is one write and neighbours are untouched.
- Broadcast moves over WebSocket (2.4) and reconcile every client to the server's state.
- Use a maintained drag library (
dnd-kit) — it handles keyboard dragging, touch, auto-scroll, and screen-reader announcements you would otherwise skip. - Virtualize long columns (10.7) once a column exceeds a few hundred cards.
Trade-offs
| Choice | Cost |
|---|---|
| Optimistic move | Instant feel; rollback UI required |
| Server-confirmed move | Always correct; feels sluggish |
| Fractional keys | One write per move; occasional rebalance |
| Integer positions | Simple to read; O(n) writes and conflicts |
Accessibility (8.2): drag-and-drop is unusable by keyboard unless you build the alternative — focus a card, press Space to lift, arrows to move, Space to drop, Escape to cancel, with each step announced via a live region. This is the most commonly skipped part of a Kanban implementation and a strong thing to raise unprompted.
Interview angle
"Two users drag the same card at once. What happens?"
- Both apply optimistically and locally, so both feel instant; the server resolves position by last write and broadcasts the result.
- Each client reconciles against its optimistic copy and animates to the server's answer, so no two boards disagree.
- The card that lost shows a toast explaining the move — silently snapping back is what makes users distrust the tool.
Recap
- Snapshot, move optimistically, reconcile or roll back.
- Fractional ordering keys turn a reorder into a single write.
- Keyboard-accessible dragging is a requirement, not an enhancement.