Skip to content

    Frontend System Design

    Front-End Case Study: Collaborative Project Management Board

    Design the front end of a shared kanban board: fractional-index ordering, last-writer-wins fields, optimistic drags, rollback and accessible moves, with a lab.

    By Published 22 min read

    • frontend-system-design
    • case-study
    • collaboration
    • drag-and-drop
    • fractional-indexing
    Share

    What you'll learn: By the end of this case you will be able to design the front end of a shared project board where several people drag cards between columns at the same time: how to store a card's position so that one drag writes one value, how to make concurrent edits converge without a central lock, how to show a drag at once and take it back when the server refuses it, how to offer a way to move a card that needs no dragging, and what to say about key growth, ties and rebalancing. You will also run a pure TypeScript core with a thin React board and tests that use no timers and no network.

    Picture a wall of sticky notes with four people moving notes between columns. If every note were numbered 1, 2, 3, moving one to the top would mean rewriting the number on every note below it, and two people doing that at once would make a mess. A good wall describes a note's place relative to its neighbours ("between these two"), and has a few house rules (this column holds at most three notes) that someone enforces. The board on a screen is the same wall. This case is about the neighbours, the rules, and what each screen shows while the answer is still on its way.

    Frame. This is an educational reference design, not the verified internal architecture of any company or product. It is a generic team board: columns such as "Backlog", "Doing" and "Done", cards with a title, drag and drop within and across columns, and several people editing the same board. It is built from public documentation (the sources linked at the end) and from a lab you can run. Every number is illustrative (chosen to make an example concrete, to be replaced by your own measurements) unless a linked source gives it. The case follows the ten parts of the case study method.

    The core idea

    Three statements carry the design.

    1. A card's position is a value it carries, not a slot in an array. If the position is an integer index, a move renumbers the cards below it and two simultaneous moves collide everywhere. If the position is a key that sorts between its neighbours' keys, a move writes one value on one card.
    2. Every field of a card is its own register, and every write carries a stamp. The title, the place (column and key) and the "removed" flag are separate. The write with the later stamp wins, ties broken by a client id, so applying the same writes in any order, or twice, gives the same board. That is what lets a screen apply its own move now and everyone else's moves later.
    3. The screen shows what the server has confirmed plus what you have asked for. A drag appears at once because the client applies its own unanswered operations on top of the confirmed state. If the server refuses one (a full column, a deleted card), the client drops it and the card goes back, with a sentence saying why.

    Requirements and targets

    Requirements. A person can see the board, move a card within a column or to another column with a drag, add a card, rename it and remove it. Other people's changes appear without a reload. A card can also be moved without dragging, with the keyboard or a single click. A column can have a limit on how many cards it holds. The board stays correct when two people act on the same card at the same moment. Out of scope: card descriptions with rich text (named below, with the labs that cover them), permissions, attachments, search and notifications, and the design of the server's storage.

    Targets (all illustrative unless a source is named):

    Target Value Why it is a target
    A drag shows its result Before any network answer The screen must not wait for the server
    Writes per ordinary drag 1 Fewer writes, fewer conflicts
    Cards that can vanish or appear twice 0 A correctness rule, not a number
    People on one board up to 20 Small rooms; a different design above this
    Cards in one column up to 200 A long list is possible, see delivery
    Responsiveness of a click or key press INP of 200 ms or less web.dev's threshold for good, at the 75th percentile

    Architecture

    Figure 1. The browser side of the board and its connection to the server

    A thin view reads a board client that keeps confirmed state plus pending operations; a connection carries operations to a server that applies rules and broadcasts accepted onesTeammate to Thin view (events); Thin view to Board client (move(card, column, index)); Board client to Thin view (snapshot); Board client to Connection (operation); Connection to Board server (send); Board server to Saved board (save); Board server to Other teammates (accepted operations)THIS BROWSERTeammate: drags, presses keysTeammatedrags, presseskeysThin view: columns, cards, buttonsThin viewcolumns, cards,buttonsBoard client: confirmed + pendingBoard clientconfirmed +pendingConnection: operations in orderConnectionoperations inorderBoard server: rules, order, broadcastBoard serverrules, order,broadcastSaved board: not in the labSaved boardnot in the labOther teammates: their own clientsOtherteammatestheir own clientseventsmove(card, column, index)snapshotoperationsendsaveaccepted operations

    How to read this: a drag or key press becomes one call on the board client. The client applies it to its own screen at once and sends an operation. The server checks the rules, applies the operation, and tells every client (the sender included) that it was accepted, or tells the sender only that it was refused.

    The board client is plain TypeScript with no DOM. The view is a short React component that reads the client's snapshot with useSyncExternalStore and calls its methods. React's documentation says getSnapshot must return the same value while the store has not changed, and that returning a new object on every call leads to an infinite loop, so the client builds a new snapshot only when something changes.

    Data and state

    Data Owner Freshness Lives in
    Which cards exist, their titles and places The server, shared by all Live, through broadcasts The client's confirmed state (base)
    This person's unanswered operations This client Until the server answers The client's pending list
    What the screen shows Derived Recomputed on every change base with pending applied
    A card's position The card Changes with each move A key and a column on the card
    Which card is being dragged This browser Only during a drag A ref in the view
    The sentence for the status region This client Changes with each action The client's snapshot

    Every operation, on its way from the screen to a final answer, is in one of three states.

    Figure 2. Life of one operation on the client

    stateDiagram-v2 accTitle: Life of one operation on the client accDescr: An operation is created by a gesture and is pending, shown on screen at once. The server then accepts it, and it joins the confirmed state, or refuses it, and it is dropped from the pending list so the screen goes back. [*] --> Pending: gesture Pending --> Confirmed: server accepts, echoed back Pending --> Dropped: server refuses Confirmed --> [*] Dropped --> [*]

    How to read this: pending operations are part of what the screen shows. Confirmed operations are part of the saved board. A dropped operation leaves the screen as if it had never been made, and the person is told why.

    Putting a card between two others

    Illustration 1, the minimal example: positions as integers

    The smallest board stores each card with an integer position in its column: 0, 1, 2, 3. Moving the last card to the top writes a new number on every card, and another person's concurrent move in the same column fights with those writes. A column of 200 cards (an illustrative size) makes 200 writes for one drag. That is the design most first versions have, and the rest of the case replaces it.

    A key that sorts between neighbours

    The replacement is a fractional index. Figma's engineering post on ordered sequences describes giving each object an index that is a fraction between 0 and 1 stored as a string, so that no precision is lost, and placing a new item between two neighbours by taking the average of their two indices. Reordering then edits a single value. The fractional-indexing library on GitHub says its keys are compared as plain strings and warns that localeCompare gives an incorrect ordering when used as a sort predicate. The lab uses a small version of the same idea in base 10, so the keys are readable: the digits of a key are the digits after "0.", and a key never ends in a zero.

    Expected output, captured from a real run (one new key between two neighbours):

    keyBetween(null, null)        = "5"
    keyBetween("5", null)         = "6"
    keyBetween(null, "5")         = "4"
    keyBetween("9", null)         = "91"
    keyBetween(null, "1")         = "05"
    keyBetween("2", "4")          = "3"
    keyBetween("2", "3")          = "25"
    keyBetween("2", "25")         = "23"
    keyBetween("19", "2")         = "195"

    Appending takes the next digit ("5" to "6"), and when the last digit is already 9 the key gains a digit ("9" to "91"). A key between "2" and "3", which are neighbours in the alphabet, has to be longer: "25". Between "2" and "25" the answer is "23". The comparison throughout is plain string comparison, where "205" sorts before "25" and "9" before "91".

    Expected output, captured from a real run (one drag, one key):

    == one drag writes one key ==
    before            backlog: A:5 B:6 C:7 D:8 E:9
    E dragged to 2nd  backlog: A:5 E:55 B:6 C:7 D:8
    operations sent for the drag: 1 (a move of E with key 55)

    Dragging E from the bottom to the second place wrote one value, "55", on E. A, B, C and D were not touched. That is the property the whole design leans on: the cost of a drag does not depend on how many cards are in the column.

    Keys grow

    The price is that keys get longer when you keep splitting the same gap. Figma's post says index length can grow over time and that its authors do not consider this a practical problem, because reordering is bounded by user activity.

    Expected output, captured from a real run (keys under repeated splitting, and under appending):

    == dropping a card into the gap right after "2", again and again ==
    first nine keys: "25" "23" "22" "21" "205" "203" "202" "201" "2005"
    after 30 drops: key "200000003" (9 digits)
    after 100 cards added at the bottom: key "999999999995" (12 digits)

    Splitting the same gap thirty times gives a nine-digit key; adding a hundred cards at the bottom gives twelve digits. A real library uses a larger alphabet and an integer part, so both grow more slowly. The shape of the problem is the same: length grows with how often one gap is split, so measure your boards and have a plan for the day one column's keys are long (see "Rebalancing" below).

    Two people at once

    Illustration 2, the realistic example: one card, two moves

    Each field of a card is a last-writer-wins register (LWW): a value with a stamp, where the larger stamp wins when two writes meet. A stamp is a counter and a client id. Each client raises its counter above every stamp it has seen, which is the rule of a Lamport timestamp: according to the description on Wikipedia, a process increments its counter before each event, and on receiving a message sets its counter to the larger of its own and the message's, plus one. Breaking ties by client id makes the order total, and the same article notes that such an order does not imply a causal relationship. For a board that is fine: we need every screen to choose the same winner, not the "right" one.

    The crdt-basics lab has a register of exactly this kind.

    Expected output, captured from a real run (the crdt-basics lab, a last-writer-wins register):

    === LWW-Register: two devices rename a document concurrently
    phone  : {"replica":"phone","timestamp":1700,"value":"Q3 plan"}
    laptop : {"replica":"laptop","timestamp":1700,"value":"Q3 roadmap"}
    tablet : {"replica":"tablet","timestamp":1650,"value":"Q3 roadmap v2"}
    merge(phone, laptop) = {"replica":"phone","timestamp":1700,"value":"Q3 plan"}  (same timestamp: greater replica id "phone" > "laptop" wins)
    merge(laptop, phone) = {"replica":"phone","timestamp":1700,"value":"Q3 plan"}
    merge(tablet, laptop, phone) = {"replica":"phone","timestamp":1700,"value":"Q3 plan"}  (the tablet write is lost: that is LWW)

    Two devices wrote at the same time, the greater replica id won the tie in every merge order, and the tablet's older write was lost. For a title, "lost" means a rename disappeared. For a card's place it means one of two drags was ignored, which is what you want: the card must be in one place.

    Figure 3. Two people drag the same card at once

    sequenceDiagram accTitle: Two people drag the same card at once accDescr: Ana drags card B to Doing and Ben drags the same card to Done, both before hearing from the other. Each screen shows its own move at once. The server accepts both and broadcasts them. Every client applies both operations, and the one with the later stamp decides the final place on all screens. participant A as Ana's screen participant S as Server participant B as Ben's screen A->>A: move B to Doing (stamp 5, ana) B->>B: move B to Done (stamp 5, ben) A->>S: operation (B to Doing) B->>S: operation (B to Done) S-->>A: both operations accepted S-->>B: both operations accepted Note over A,B: same counter, so the greater client id decides: B ends in Done on every screen

    How to read this: both moves are legal and both are sent. No one is asked which should win. Every client applies the same rule, so they all end in the same place without talking to each other.

    Expected output, captured from a real run (the same card dragged by two people at once):

    == two people drag the same card at once ==
    before anything is sent
      ana  backlog=[A C D] doing=[B] done=[]
      ben  backlog=[A C D] doing=[] done=[B]
      cy   backlog=[A B C D] doing=[] done=[]
    after everything is delivered
      ana  backlog=[A C D] doing=[] done=[B]
      ben  backlog=[A C D] doing=[] done=[B]
      cy   backlog=[A C D] doing=[] done=[B]
    same board everywhere: true

    Before anything is sent the three screens disagree, which is fine: each shows what its owner asked for. After delivery, every screen shows B in Done, once.

    Why not delete and insert

    A move can be modelled as "delete the card from here, insert it there". The abstract of Martin Kleppmann's paper "Moving Elements in List CRDTs" says existing algorithms behave poorly when users concurrently move list elements, and describes an algorithm that adds an explicit move operation to a list CRDT. The lab does not implement that algorithm; naive.ts is a tiny model of the problem the abstract points at.

    Expected output, captured from a real run (a move written as delete plus insert):

    == the same race with a move written as delete plus insert ==
    start A B C; ana moves A to the end, ben moves A after B
    merged: B A C A  (A appears 2 times)

    Both people deleted the same entry, which is harmless, and both inserted a new one, which is not: the card is in the list twice. Storing the place as a field of the card avoids this, because a card has one place register and two writes to it produce one value.

    Illustration 3, a failure and an edge: two cards, one gap

    Two people can drop different cards into the same gap at the same time. Both clients compute "between A and B" from the same neighbours and get the same key. Figma's post says averaging breaks in this case, and that its server avoids ever having two objects with an identical position by giving the second insert a unique one. The fractional-indexing README only notes that random jitter can reduce collisions when keys are generated concurrently, and points to a separate package. The lab makes a third choice: it allows equal keys, breaks the tie by card id so every screen shows one order, and handles the one awkward case, a drop between two cards that share a key, by rewriting the cards after the first of them.

    Expected output, captured from a real run (two cards dropped into the same gap, then a third drop between them):

    == two cards dropped into the same gap at once ==
    start                       A:5 B:6 C:7 D:8
    both dropped between A, B   A:5 C:55 D:55 B:6
      (C and D share a key; the card id puts C first on every screen: ana backlog=[A C D B] doing=[] done=[])
    cy drops A between C and D  C:55 A:58 D:59 B:6
      operations for that drop: 2 (A, and the cards that shared the key)

    C and D share the key "55" and appear in id order everywhere. When cy drops A between them, there is no key between two equal keys, so the plan is two writes: A gets "58" and D moves to "59". The rule to keep is that equal keys are legal and one order is shown, and a drop between equal keys costs more than one write.

    Fields that do not conflict

    A rename and a move touch different registers, so both survive. A removal is different: in the lab a removed card stays removed, which means a delete wins over a concurrent move or rename.

    Expected output, captured from a real run (rename and move, then delete and move):

    == a rename and a move at once, then a delete and a move at once ==
    rename + move: cy sees "Card A (renamed)" in done
    delete + move: cy sees backlog=[] doing=[] done=[A]

    "Delete wins" is a product decision, not a law. Pick one on purpose and write it down.

    The screen while the answer is on its way

    The client keeps base, the state the server has confirmed, and pending, its own operations that have no answer yet. The screen shows base with pending applied. The Optimistic Updates and Rollback lesson explains the pattern and has its own lab; here the operations are board operations. When the server broadcasts an accepted operation, the client removes it from pending if it is its own (the echo is the answer) and applies it to base. When the server refuses an operation, the client removes it from pending, which is all a rollback is.

    Expected output, captured from a real run (a move the server refuses because a column is full):

    == a move the server refuses: the card goes back ==
    start                  ben  backlog=[C] doing=[A B] done=[]  (Doing holds 2 at most)
    ben drags C to Doing   ben  backlog=[] doing=[C A B] done=[]  pending=1
    server answers         ben  backlog=[C] doing=[A B] done=[]  pending=0
    message: Could not change C: column "Doing" is full (limit 2)

    Ben's screen shows C in Doing at once, with pending=1. The server enforces the limit, which is a rule that depends on the order operations arrive in and so cannot be left to clients. It answers with a refusal, and C goes back to Backlog, with a message the status region can announce. A client could also check the limit locally and refuse to start the drag, which is better manners, but the server's check is the one that counts.

    A pending operation that loses a conflict needs no special handling: if Ben's move had the older stamp, his screen would already show the winner's place, and his operation coming back confirmed changes nothing.

    The interface: drag, keyboard and announcements

    Dragging. MDN's guide to the HTML drag and drop API says to set draggable to "true" on an element to make it draggable. dragstart and dragend fire on the dragged item, and dragenter, dragleave, dragover and drop on potential drop targets. Most elements are not drop targets until their dragover event is cancelled with preventDefault(). The drag data store can be read only during drop (apart from dragstart), so the view keeps the dragged card's id in a ref. dropIndex turns where it was dropped (onto a card, or the empty part of a column) into the index moveCard expects, counted without the dragged card.

    Figure 4. The states of a drag

    stateDiagram-v2 accTitle: The states of a drag on the board accDescr: A card is idle until dragstart, when it is being dragged. Dragging over a card or column keeps it being dragged. Dropping on a card or the empty part of a column calls the move and returns to idle. Dropping elsewhere or ending the drag returns to idle with no change. [*] --> Idle Idle --> Dragging: dragstart Dragging --> Dragging: dragover a card or column Dragging --> Idle: drop on a card or column (move) Dragging --> Idle: drag ends elsewhere (no change)

    How to read this: the board changes only on a drop. A drag that ends anywhere else costs nothing and sends nothing.

    Moving without dragging. WCAG 2.2 success criterion 2.5.7, Dragging Movements (Level AA), requires that functionality that uses a dragging movement can also be achieved by a single pointer without dragging, unless dragging is essential. The page adds that this is separate from keyboard access, because touch users may have no keyboard. The lab's cards therefore have plain buttons (move up, move down, move to another column) that call the same moveCard; their accessible names include the card title.

    Announcing the result. A screen-reader user needs to be told that a card moved. WCAG 4.1.3, Status Messages (Level AA), asks that status messages can be presented by assistive technology without receiving focus. MDN's live regions guide says a polite region is spoken when the user is idle and recommends including the region in the initial markup so it is registered before its content changes. The board renders a visually hidden role="status" element in its first render and changes only its text, for example "Moved Ship to Backlog, position 2 of 3". The sentence comes from the core, so a test can check it without a browser. What a particular screen reader says was not tested.

    Text, history and presence: where the other labs fit

    A card is more than a title. These parts have their own lessons; the case only says how they attach.

    Expected output, captured from a real run (the undo-event-sourcing lab, an undo after a remote change):

    === 6. undo after someone else changed the same item (a remote event reaches the log)
      local 3, remote sets 5 [milk=5]  log 3
      undo "milk to 3"       refused: QtyChanged does not fit the current state: quantity is 5, the event expects 3
      after the refusal      [milk=5]  log 3  undo depth 2 (nothing was half-applied)

    The inverse no longer fits, so it is refused whole. On a board, if someone else moved the card after your drag, "undo" should not drag it back over their decision without asking. See Undo, Redo and Event Sourcing in the UI.

    Delivery and performance

    The board is an application behind a login, so its HTML is mostly a shell; see Rendering Strategies.

    Responsiveness. web.dev defines Interaction to Next Paint (INP) as the latency of click, tap and keyboard interactions, with 200 milliseconds or less as good at the 75th percentile. A drop plans one key, applies the operation and notifies the view; nothing waits for the network. See INP and Responsiveness.

    Long columns. At 200 cards, rendering every card is a cost; List Virtualization covers windowing. A drop target that is not rendered cannot receive a drop, so decide which matters more. The case sets no byte or millisecond budget, because any figure would be invented.

    Failure modes

    Failure What the person sees Response
    Two people move the same card Both drags show, then everyone converges LWW register on the place; one winner
    Two cards dropped into one gap One stable order Equal keys allowed; tie by card id; rewrite on a drop between equal keys
    The server refuses a move (full column) The card jumps back, with a message Drop the pending operation; announce the reason
    A card is removed while someone drags it The card disappears Delete wins; the move is refused or ignored
    A drag is not possible (touch, motor limits) Buttons that do the same Single-pointer alternative, same moveCard
    Keys grow long in a hot column Nothing, until size matters Measure; rebalance when quiet
    The connection drops Changes show as not confirmed Keep pending; replay on reconnect (not in the lab)
    A reload during a pending move The move is lost Persist pending; see the offline lesson

    Rebalancing, and the hazard that remains

    When a column's keys have grown long, planRebalance rewrites it with short, evenly spaced keys in the same order, using as few writes as the new keys require.

    Expected output, captured from a real run (rebalancing a column of 15 cards):

    == rebalancing a column whose keys have grown ==
    15 cards, longest key 4 digits; first five: A:5 n12:5001 n11:5002 n10:5003 n9:5005
    rebalanced 15 cards, longest key 2 digits; first five: A:06 n12:12 n11:18 n10:24 n9:3
    same order: true

    This is the one operation that is not safe when other people are moving cards in the same column. A move planned against the old keys and a rebalance that rewrote them can disagree about where "between A and B" is, and last-writer-wins will not repair that. The lab does not solve it. Two ways: serialise rebalancing on the server and make moves carry the key version they were planned against, so a stale one is refused (the lab's stretch exercise), or rebalance only when nobody else is in the column.

    Trade-offs

    Decision Choice Cost Revisit when
    Position Fractional string key per card Keys grow; ties need a rule; rebalancing needs care Columns get very long, or keys exceed a size you set
    Conflict rule LWW per field, stamp then client id One of two concurrent writes is lost Losing a write is not acceptable (titles with long text)
    Who enforces rules The server, after the client's optimistic move A refusal makes the card jump back Rules can be checked locally without drift
    Ties Equal keys allowed, id breaks the tie A drop between equal keys writes several cards Ties become common
    Alternative to LWW fields A list CRDT with a move operation More state, a library to adopt Offline-heavy use, no central server

    Build it

    The lab is examples/frontend/labs/board-ordering: a pure TypeScript core and a thin React board. The files are fractional.ts (keys), board.ts (registers, stamps, apply, planMove), session.ts (the server, the client with base and pending, and a hub of queues you step by hand), drop.ts, naive.ts (the model that fails), Board.tsx and demo.ts. It also reuses two published labs: crdt-basics for the register rule and undo-event-sourcing for the refused undo (their output is shown above).

    cd examples/frontend/labs/board-ordering
    pnpm test          # 41 tests
    pnpm typecheck
    node src/demo.ts   # prints the blocks shown in this lesson

    The 41 tests passed in the run made for this lesson: 9 for the keys (including 3,000 random inserts in two alphabets), 15 for the board model (equal keys, every order of the same operations giving the same board, the delete-plus-insert duplicate), 10 for the session (optimistic moves, refusal, concurrent edits, 150 seeded random sessions that must all end on the server's board with no card twice) and 7 React tests under jsdom. jsdom is a JavaScript model of the DOM, not a browser: the drag tests fire synthetic events, and no real pointer, touch, layout or screen reader was involved.

    Expected output, captured from a real run (200 seeded random sessions):

    == 200 random sessions (seeds 1 to 200): 3 clients, 60 steps, random delivery order ==
    sessions where every client ended on the server's board: 200 of 200
    sessions where no card appeared twice on any screen: 200 of 200
    operations the server accepted: 7113, refused: 1575
    the same board from the accepted operations applied in reverse order: yes, in every session
    longest key seen: 3 digits

    All 200 sessions converged, with 1,575 operations refused by the server along the way. The demo does not break the refusals down by reason.

    Break it. In board.ts, in later, replace the body with return { value, stamp };, so the last operation to arrive wins instead of the one with the later stamp. In the run made for this lesson, the test "gives the same board for every order, and when applied twice" and the 150-session test failed, and the demo stopped with an error. The code was restored and the tests re-run. The point of the experiment: convergence is not a property of the network; it is a property of the merge rule.

    The output blocks above are verbatim excerpts of examples/frontend/golden/board-ordering.txt, examples/frontend/golden/crdt-basics.txt and examples/frontend/golden/undo-event-sourcing.txt, captured with node examples/frontend/tools/capture-golden.mjs.

    In practice: a planning board that kept reordering itself

    The situation

    A product team of about a dozen shares a planning board. Cards move constantly in the weekly meeting. Two complaints arrive: dragging in the long Backlog column feels slow, and sometimes a card snaps back after being dropped.

    Starting architecture

    • Each card stores an integer position in its column.
    • A drop sends the new positions of every card in the column below the drop point.
    • The server applies the writes in arrival order, with no stamps.
    • The screen shows the server's answer when it comes.

    Options considered

    1. Debounce the writes and send them in a batch.
    2. Keep integer positions but renumber on the server only.
    3. Replace the integer with a fractional key, make each field a stamped register, and apply the drag to the screen before the answer.

    The decision

    Option 3. Batching hides the cost but leaves two renumberings colliding, and server-side renumbering still makes every drag a write to many cards. The key makes a drag one write, the stamps make two drags converge, and the pending list makes the drop instant. The costs are a string key to explain, a tie rule and the key-growth question.

    Rollout and verification

    The team writes tests first: a model test where every order of the same operations must give the same board, a session test with a fake connection and random delivery, and a test where a fake server refuses a move. The old model fails the first. Old integer positions are converted once into spread keys by a script run first on a copy. They ship behind a flag and watch writes per drop, the rate of refused operations and the longest key.

    The 2 a.m. failure

    An import job appends three thousand cards to one column in a loop, so keys keep growing (in this lab's base-10 alphabet a hundred appends gave twelve digits; a real library grows more slowly), and a key-length alert fires. The responder checks the order is intact, pauses the import and rebalances that column with nobody else in it. They change the import to write spread keys in bulk and file a ticket for the key version that would make rebalancing safe while people work.

    This is a realistic scenario, not a case history.

    The other side of this topic

    A back-end design for the same board stores the keys with an index, serves the ordered list, validates the stamps and decides how rebalancing is serialised. The two meet at the contract: what a key is, who may write it, what happens to an operation that lost a conflict, and how a client that was offline for an hour catches up. The general theory is in CRDTs and Conflict Resolution.

    Architect's notes

    • Store a position as data on the card, so a drag costs one write.
    • Give every field its own stamped register, so unrelated edits never conflict.
    • Let the server enforce the rules that depend on order; let the client show the result first.
    • Allow equal keys and define one order for them.
    • Name the one unsafe operation (rebalancing) and who may run it.

    Common mistakes

    • Integer positions. A move rewrites a column and two moves collide.
    • localeCompare on keys. Plain string comparison is the order of the fractions.
    • A move as delete plus insert. Two people moving one card can duplicate it.
    • Letting the last operation to arrive win. Convergence needs a rule that ignores arrival order.
    • Drag and drop only. WCAG 2.5.7 asks for a way that needs no dragging.
    • Limits checked only on the client. The server decides the order of operations.

    Key takeaways

    • A position is a key between neighbours; one drag writes one value, and keys grow when one gap is split repeatedly.
    • Per-field last-writer-wins registers with stamps make operations commute, so any order gives the same board.
    • Equal keys are legal if you define a single order for them.
    • The screen is confirmed state plus pending operations; a refusal removes the pending operation.
    • Offer a way to move a card without dragging, and announce the result politely.
    • Say what the lab cannot show: real browsers, touch, screen readers, networks and offline use.

    Practice exercises

    Exercise 1: Beginner (30 minutes). Run the demo. For each block, write down which of the three statements of the core idea it demonstrates.

    Exercise 2: Intermediate (2 hours). Change later so that a removal is undone by a later move of the same card, and write the test that shows the new rule. Say what a user would notice.

    Exercise 3: Intermediate (2 hours). Add an epoch to each column that rebalance raises, have moveCard operations carry the epoch they were planned against, and make the server refuse a stale one. Write a test with a move racing a rebalance.

    Exercise 4: Advanced (3 hours). Score this case against the ten-part rubric of the case study method and write the paragraph that would raise its lowest part.

    Official documentation

    In this course

    Ask about this article

    Get answers grounded in this post. AI-generated — based on this article, and may be imperfect.

    Scaled AI Weekly

    Enjoyed this? Get more like it every Monday.

    Real architecture decisions, LLMOps patterns that survive production, and engineering leadership advice — from 12+ years of building at enterprise scale. Free. No spam. Unsubscribe anytime.

    Get new articles by email

    Free. We email a confirmation link first, and you can unsubscribe from any email.

    Join engineers building production AI systems

    Comments