How frunt's demo restaurant runs on the real dashboard and never goes stale

frunt's demo signs a visitor in to the real dashboard as the owner of a made-up restaurant. Every write is refused twice, by a request filter and by database policies, and the venue is built through the product's own code, so it changes when the product does.

By Matthew Kay//10 min read

frunt's demo is not a copy of the product. A visitor who opens it is signed in to the real manager dashboard as the owner of a made-up restaurant, with no password and nothing asked of them. Every change they try is refused in two places that don't depend on each other: a filter in front of the API, and restrictive policies in the database. The restaurant is built through the same code that files a real venue's documents, so when the product changes, the demo changes with it.

The frunt demo on a phone: a welcome card reading "Welcome to [Your Restaurant]", a note that everything in it is made up and nothing you change is saved, the five things the two-minute tour covers, and Start the tour and Look round on my own

Why does frunt need a demo at all?

frunt is for hospitality owners and managers, and most of them aren't technical. They could read the landing page and still not know what frunt looks like to use. There were two ways to find out. Book a walkthrough, which means a form and a call. Or sign up, which means a form, a password and then an empty dashboard with nothing in it. The walk-in demo showed the staff app on a phone. Nothing showed the manager's side without a login.

The goal was a link that drops someone into a working restaurant they can tap through, on a phone or a laptop, in two minutes.

Why not a clickable screenshot tour?

A tour made of screenshots was the obvious first option. It is about a third of the work and has no security surface at all. It also goes stale with every redesign, because each screen has to be captured again. It can't be explored, and it can't show frunt answering a question.

The other obvious option was a private copy of the venue for every visitor. Writes would be safe to allow, but it means an auth user and a tenant per visitor, something to clean them up, and anonymous sign-ins turned on across the live project.

We chose a third way: one shared restaurant, on the real dashboard, read-only. Every page a visitor sees is the page a real manager sees, so there is nothing to recapture.

How does a visitor get in without a password?

/demo is a door. On the server it mints a one-time sign-in link for the demo login and verifies it straight away, the same verification frunt's invite links use. The visitor lands signed in, with the tour open.

There is no password, so a visitor can't change one and lock the next visitor out. Each opening also resets the login's user metadata, because a visitor could set a flag there that sends everyone after them to a set-password page.

The login is the venue's owner. That is the prospect's own point of view and the fullest view of the dashboard. It also costs nothing extra: frunt already leaves owners out of the rota, the training matrix and the inspection pack unless they opt in, and never counts an owner as a paid seat. So the demo login never appears among the venue's people.

Three smaller guards:

  • A prefetch never opens the door. Opening /demo signs someone in, so the route answers 204 to anything marked as a prefetch, and the landing's links to it are plain links.
  • Someone already signed in to their own frunt is asked first, never quietly signed out.
  • A visit that loses its session goes back through the door, not to a login form. One visitor choosing "sign out everywhere" ends every demo session, so a cookie remembers that the browser came in through the demo.

How is it read-only?

The demo login carries demo: true in its app_metadata. Only the service role can write app_metadata, so a visitor can't remove the flag. Two checks read it, and neither relies on the other.

The request filter. The middleware refuses every write a demo session sends to the API:

// Simplified from frunt's middleware.
const SAFE = new Set(["GET", "HEAD", "OPTIONS"]);
const isDemo = user?.app_metadata?.demo === true;
 
if (isDemo && path.startsWith("/api/") && !SAFE.has(method)) {
  return NextResponse.json(
    {
      error: "demo_read_only",
      detail:
        "This is a demo restaurant, so nothing you change here is saved.",
    },
    { status: 403 },
  );
}

frunt has no server actions, so every change the dashboard can make goes through /api. That one check covers all 143 write routes without any of them knowing the demo exists, and a route added tomorrow is covered too.

The database. A session can also write straight to Supabase's API with the public key, skipping the app entirely. A comment every later visitor would see, or the owner renaming the venue, would get through the filter that way. So every public table with row level security got three restrictive policies, one each for insert, update and delete:

-- One of three, created for every public table with row level security on.
create policy "demo sessions do not insert" on public.<table>
  as restrictive for insert to authenticated
  with check (
    ((select auth.jwt()) -> 'app_metadata' ->> 'demo') is distinct from 'true'
  );

At release that was 237 policies on 79 tables. Postgres combines restrictive policies with AND against the permissive ones, so they can only narrow what a session may do. No other session is affected, and the service role bypasses them as before. A test fails CI if a later migration lets signed-in users write to a new table without the same three policies.

Keeping the demo away from real venues needed nothing new. A demo login belongs to one tenant, and frunt's tenancy only ever shows a login its own tenant.

Whose restaurant is it?

Nobody's. The venue is called [Your Restaurant] and its people are [Sofia], [Tom], [Marcus] and five more, in the brackets frunt already uses for placeholders. A visitor should never wonder whether they are looking at some other restaurant's records. It reads as frunt with their own restaurant filled in.

The brackets also mark every export as demo data without a watermark. An inspection pack headed [Your Restaurant] that lists [Sofia] can't be passed off as a real record.

The demo's Who's trained page on a phone, under the demo banner: 88% compliant, 21 of 24 requirements met, 2 expiring within 30 days, and bracketed staff such as [Marcus] in the kitchen with food hygiene expired and [Amir] on the floor with two courses not started

Its content was written for the demo, not copied from frunt's test documents. Those have mistakes planted in them on purpose, and the demo has to look like a well-run restaurant:

  • the ten documents frunt's readiness check looks for in a venue serving food and alcohol, plus a menu and opening and closing procedures;
  • 15 dishes, and an allergen matrix that parses to exactly those 15;
  • eight people and three courses written from the venue's own documents;
  • a believable training picture: most people current, two expiring, one expired, two not started;
  • five sign-offs still owed.

A test checks the cross-references: the matrix parses to the menu, every citation points at a real heading, every key resolves.

How does a made-up restaurant stay real?

The demo is built the way a real venue is. The build files each document through frunt's real adoption code: it drafts the document, confirms the ingestion job, then runs the same persist job a real upload runs. The venue ends up with exactly the rows a real venue has, and every later migration that reshapes real venues reshapes the demo too. A copy written straight into the tables would break the first time ingestion changed.

Nothing in the build calls a model:

  • The menu's dishes arrive already read. The build writes them into the job's cache under the same key the item reader uses, so the reader never asks the model.
  • Every seeded answer goes through the real allergen check, with facts from the demo's own matrix, exactly as a live answer would. The verified footer and the refusal wording come from the check, never from the demo's content files.

A seeded answer in the demo on a phone: "Does the beer-battered haddock contain gluten?" answered from the allergen matrix, marked as read from the structured record and not AI-generated, with the allergens the dish contains, a note to re-check if a recipe or supplier changed, and the Allergen Matrix as its source. The tour has shrunk to a slim bar with Show me again and Next

There are 13 seeded questions. Each one says which outcome it was written to show: 8 answered from the documents, 2 verified allergen answers, 1 allergen refusal and 2 the documents don't cover. If the real allergen check would now give a different outcome, the build reports it. The demo can't show frunt saying something frunt would refuse to say.

A visitor can't type a live question. A typed question opens the closest seeded one, or explains what the demo can do. Live answers with a daily cap would have cost about £1.50 a day at worst. Seeded answers make a visitor cost nothing. The one spend is embedding the documents when they are first filed: a fraction of a penny, once.

What keeps it from going stale?

Every way the demo could drift has something holding it:

What could drift What holds it
Screens change Nothing to do: it is the live dashboard
Dates such as "expires in 12 days" or "asked yesterday" A job at 04:17 UTC every night moves every date forward to today
The documents or the team change in code The build stores a hash of them. On a mismatch it deletes the venue (48 tables cascade from it) and builds it again
A tour stop points at something that moved Each stop names a mark in the page, and a test fails CI if the mark or the page is gone
A new manager page ships empty in the demo A test lists every manager page and fails until the demo says what it shows there
A seeded answer the allergen check would now refuse The build reports it in the run's verdict

Every nightly run records a verdict, and the job is on the list frunt's heartbeat checks, so a run that stops happening gets noticed.

What did testing find?

The demo went live the day it was built, and the same day it was looked at on a phone. Two things changed.

  • Phones get the demo, led by the tour. The dashboard is designed for a computer, and the easy answer was to ask phone visitors to come back on one. Most owners find frunt on their phones, so turning them away would lose most of them. The dashboard was checked at 390 pixels wide (no sideways scrolling, every tour stop reachable), so the demo stays on phones with the tour as a full-width sheet. Two wide tables got a line above them, "Swipe sideways to see every course.", which helps real managers on phones too.
  • The tour hid its own result. A page audit of the tour found twelve points. The worst: on a phone, doing the first stop's "Try this" opened the answer and left it dimmed, with the tour's sheet covering the verified facts. Each stop now has three states. While it is pointing at something it lights it with the full card. While the page loads it waits. Once the visitor has done the thing or moved on, the card shrinks to a slim bar with Show me again and Next, and nothing is dimmed.

The tour's first stop on a phone: the questions people at the venue asked frunt, the first five lit, and a full-width sheet at the bottom reading "Ask frunt about anything in your documents" with a Try this line and Back and Next

One limit is known and written down. Supabase limits sign-ins per IP address, so a burst of visitors on one network, a room at an event for example, could send some of them to the demo's "unavailable" page.

Where does it stand?

The demo is live on frunthospitality.com. "Look round a demo restaurant" is the hero's main button, with the line "No sign-up. Everything in the demo is made up." Booking a walkthrough stays the next step after it. The same link is the walk-in demo. Changing the demo means editing its content files and running the tests, and the next nightly run rebuilds it.

The short version

  • Put visitors in the real product, read-only, instead of a copy of it. A copy goes stale with every redesign. The real dashboard can't.
  • Refuse writes in two places that don't depend on each other: in front of the API, and in the database. Mark the session with a flag the visitor can't change.
  • Make demo data obviously made up. Brackets in every name mean no visitor mistakes it for someone else's records, and no export passes for a real one.
  • Build the demo through the product's own code, so every migration and every change to the product reaches it.
  • Give every way the demo can drift a test or a job that catches it, and record each run.
Next.jsSupabaseRow Level SecurityHospitality

02/More build notes

More build notes