Skip to content

Part 1 of 7 · Shift swap broker series ~6 min read

A shift swap broker on AWS for a few dollars a month

Shift swapping in a small business happens in a group chat, and the group chat is genuinely quite good at the social part. What it cannot do is check anything. So the swap gets agreed by two people on Tuesday and a manager discovers on Thursday that the cover is not trained on the till, or is already on a double, or has just gone into overtime. This post walks through a small system that does the checking before anybody agrees to anything.

A person in dark clothing loading cardboard boxes into a yellow delivery van
Photo by Claudio Schwarz on Unsplash

Key takeaways

  • Eligibility is checked before an offer is made, not after a swap is agreed.
  • Four checks: qualified, free, not into overtime, not over their swap cap.
  • Offers go out in an order you set, not to everybody at once.
  • A manager approves one clean swap. Nothing writes the rota except that approval.
  • Designed on AWS for about $2 a month.

The whole system on one page

Before any code, here is the shape of what we are designing.

System: a rota and rules in, one approvable swap outThree boxes across the top sit outside the AWS account. On the left, The rota: who is on and where. In the middle, Rules: the skills each station needs, the per-person swap caps and the overtime thresholds. On the right, Staff and manager: the people offered a shift and the person who approves. Each connects by an arrow to the AWS account container below. Shifts and cover flow down into the account. The rules feed in who may work what. One swap to approve goes back out. Inside the AWS account are three components in a row. On the left, Eligibility, running four checks before any offer goes out. In the middle, the Offer loop, which offers in order with a time limit. On the right, Approval, which turns one tap into a rota change. A note at the bottom says nothing writes the rota except a manager approving, and the system only proposes.AWS ACCOUNTThe rotawho is on, whereRulesskills, caps, overtimeStaff + manageroffered, then approvedEligibilityfour checks, beforeany offer goes outOffer loopin order, witha time limitApprovalone swap, one tap,then the rota movesshifts and coverwho may work whatone swap toapproveNothing writes the rota except a manager approving. The system only proposes.
Fig 1. Three things outside the account, three pieces inside it. The eligibility box runs first, which is the whole difference between this and a group chat.
  • Machine learning
  • Management
  • Analytics
  • People

The four checks

CheckReadsWhy it has to come first
QualifiedThe skills each station needsA swap onto a station somebody cannot work is not a swap
FreeThe rota for that day and around itAlready on, or on a rest day that would be broken
OvertimeHours already rostered that weekA swap that quietly costs time-and-a-half
Swap capSwaps taken in a rolling windowOne person absorbing every gap is a problem for them

Every one of those is checkable in advance and none of them is checkable in a group chat. Doing them before the offer rather than after the agreement is the entire design, because a swap that gets agreed and then refused is worse for everybody than one that was never offered.

What runs on every request (the inside)

  • Eligibility. Runs the four checks against everybody and produces a short ordered list, usually three to six people. It is arithmetic against a rota and a rules sheet, and no model is involved anywhere in it.
  • The offer loop. Offers the shift to the list in order, one or a few at a time, with a time limit. Offering to everybody at once produces a race and hurt feelings; offering one at a time takes too long. Part 4 covers the middle ground.
  • Approval. Sends the manager one message: who is giving up what, who is taking it, and the sentence that matters — that all four checks passed, or which one was overridden. One tap writes the swap to the rota.

One swap, end to end

One shift swap from request to approved rota change, in five stagesA horizontal row of five boxes joined by arrows. Offered up: somebody says they cannot do Thursday. Checked: the system works out who is actually eligible. Offered out: in order, with a clock. Taken: by the first person to accept. Approved: one tap, and the rota moves. A note says the manager appears once, at the end, with nothing left to work out.ONE SWAP, END TO ENDOffered upI can't do ThursdayCheckedwho is actually eligibleOffered outin order, with a clockTakenfirst to acceptApprovedone tap, rota movesThe manager appears once, at the end, with nothing left to work out.
Fig 2. The same system as one line. A manager is involved exactly once, and by then every question they would have asked has already been answered.
  • Machine learning
  • Management
  • Analytics
  • Front-end & mobile
  • People

In plain words

A supervisor cannot work Thursday evening and says so on Monday. The eligibility check runs: eleven people work that site, four are already on Thursday, two are not trained on the station, one would cross forty hours, and one has taken four extra shifts this month and is at their cap. That leaves three, ordered by who has taken the fewest extra shifts recently.

The offer goes to those three with a four-hour window. The second one accepts within twenty minutes. The manager gets one message: “Thursday 6–11, Ash giving up, Rae taking. Qualified, free, 31 hours before this, 3 swaps in the last 30 days. Approve?” They tap approve on their phone and the rota updates. Total manager involvement: about eight seconds, and the alternative is a group chat they have to read and then check four things by hand.

Design rules that shaped every decision

  • Check before you offer. A swap that is agreed and then refused damages more than one that was never offered.
  • Offer in an order, not to everybody. A free-for-all gives every shift to whoever has notifications on.
  • The cap protects the person as much as the business. Somebody absorbing every gap is heading somewhere bad.
  • Only approval writes the rota. The system proposes; a manager decides, always.
  • An override is allowed and recorded. Sometimes the untrained person is the right answer and a manager knows why.
  • Nobody is told who declined. A shift going to the third person on the list is not information anybody needs.

Why this shape

The group chat is not the problem; it is a reasonable place to ask a question. The problem is that the answer it produces is unverified, and verification is exactly the part a computer does well and a manager does slowly on a Thursday.

So the design leaves the social part alone — people still know who covered for them, and can still ask each other directly — and inserts the four checks in front of the offer. A manager stops being the person who discovers problems and becomes the person who approves a decision that has already been checked.

The next four posts walk through each piece: how a shift gets offered up, how eligibility is computed, how the offer loop works, and how an approval writes the rota. One diagram per post, a cost breakdown, and an engineering reference at the end.

All posts