Shift plans lived in a group chat.
Vagtflow
Shift bidding for a restaurant, run by its own staff.
- Type
- Web app
- Status
- In use
- Year
- 2026
How it was built
Vagtflow is the shift-bidding app for Restaurant Børkop Vandmølle (around 19 staff). An admin posts open shifts; staff bid on them from their phones; the app moves each shift through its states and notifies the people involved. It is live and in daily use, installed to the home screen as a PWA. It is also the first system delivered through Tarnix, my company, and the reference every later conversation starts from.
A shift is a state machine
Every shift moves from available to pending to taken, with withdrawn as
the escape hatch. The Postgres schema models it directly: a shifts table with
an owner, a bidder, and the person it was taken by, plus profiles and
notifications. A trigger creates a profile row when a new auth user appears,
copying name and phone from the sign-up metadata.
Trust lives in the database
The browser is never trusted to mutate state on its own. Row-Level Security scopes what each staff member can read and write, and changes go through RPCs rather than direct table writes. Admin actions that need elevated rights, creating or deleting a user, run in a Supabase edge function, so no service key is ever shipped to the client.
What I learned
-
A shift is a small state machine: available, pending, taken, or withdrawn.
-
Writes go through Postgres RPCs and RLS, not trusted client code.
-
An edge function handles admin user create and delete so no service key ships to the browser.