README.md

🍽️ Lunchtime #

Organise group lunches and split the bill — no fuss.

Live: https://bright-signal-e2b57c.lakebed.app

What it does #

Lunchtime lets a cook create a lunch event, share a link with participants, and track who has paid. No accounts needed for participants — only cooks sign in.

  • Create events with a title, date, and optional max capacity
  • Share a link or QR code — participants join without an account
  • Close the event when it's done and set the final price per person
  • Track payments — mark participants as paid or remove them
  • Participant view — look up your open payments by name
  • Opt-in event alerts — a private inbox with final prices, unread counts, and links to payment details
  • Optional device push — background alerts through the browser's push service, without an email or paid provider

Tech #

Built as a Lakebed capsule:

Layer File What
Server server/index.ts Schema, private notification queries, mutations, service-worker and manifest endpoints
Push server/push.ts VAPID authentication and service worker source
Client client/index.tsx Preact SPA with hash routing, Tailwind CSS
Shared shared/types.ts Types and utility functions

Key constraints of the Lakebed runtime:

  • Only string() and boolean() field types — numeric values stored as strings
  • Queries are reactive subscriptions (no parameters) — parameterised reads use mutations
  • No static file serving — backgrounds are CSS gradients, fonts load from Google Fonts
  • No npm packages — QR codes via external API

Running locally #

lakebed dev

Opens at http://localhost:3000 with guest auth.

Deploying #

lakebed deploy

Features #

Event notifications #

When joining, participants can check Notify me when this event closes (off by default). They can change the preference from the event or Notifications → Your event alerts until the event closes. No email is required. The cook's final price and party total appear in each opted-in participant's inbox, even if their tab was closed. Repeated close requests do not duplicate alerts; reopening and closing again creates a new alert with the new price.

Notifications and preferences use Lakebed's authenticated identity. Guests must return in the same browser session; clearing site data or signing out loses access to that guest identity. Signing in with Google carries the guest's registrations, inbox, and push devices to the account. Existing registrations created before this feature have no recorded owner and are not claimed by matching public names or email addresses; only new registrations can be managed this way.

Background push setup #

Use Lakebed 0.0.33 or newer for the HTTP endpoint and guest-upgrade support. The inbox works without push configuration. To enable push for a deployment:

  1. Generate keys once: node scripts/setup-push.mjs https://your-app.lakebed.app (a mailto: contact is also supported).
  2. Keep the generated, gitignored .env.lakebed.server secure. It defines PUSH_VAPID_PUBLIC_KEY, PUSH_VAPID_PRIVATE_JWK, and PUSH_VAPID_SUBJECT. Reuse these keys on every deploy; rotating them invalidates existing subscriptions. The script refuses to overwrite existing keys.
  3. Ensure the Lakebed deployment is claimed, then run lakebed deploy from the directory containing that environment file. In CI, restore the same .env.lakebed.server from secrets before deploying; the existing workflow does not generate or carry this ignored file. Anonymous deployments cannot send push because outbound fetch and hosted server env require a claim.
  4. Participants open Notifications → Enable push on this device and allow the browser prompt. Push is sent only for their opted-in event registrations. They can disable it on each device without changing inbox preferences.

Push requires HTTPS (localhost works for development), a browser with Web Push support, and notification permission. On iPhone/iPad (iOS/iPadOS 16.4+), add Lunchtime to the Home Screen and open that installed app before enabling push. Delivery remains subject to browser/OS settings. The worker runs without an open app tab; it shows a generic closure alert and opens the private inbox. It deliberately receives no event, name, or payment payload. Chrome/Edge, Firefox, and Apple's push endpoints are supported; up to five devices can be registered per identity.

The inbox is the durable record. Push is best effort: delivery errors leave the inbox intact and show Retry push alerts to the cook. Expired subscriptions are removed. There is no background retry scheduler, so retries can repeat a push on a device that already received it. Each device alert is kept separate so a later event-close alert cannot replace a food-ready alert. Push is attempted while closing, so it can add up to about two seconds of network wait. Deleting an event or removing a participant also removes its inbox alerts and preferences.

Verification #

npx lakebed build
npm exec --yes --package=lakebed@0.0.33 -- node scripts/test-notifications.mjs

# With lakebed dev running on port 3000:
npm exec --yes --package=@playwright/test -- playwright install --with-deps chromium
npm exec --yes --package=@playwright/test -- node scripts/test-browser.mjs

Server checks use Lakebed's real in-memory database and mocked push services, including VAPID signature verification, authorization, opt-out, retries, removal, and guest upgrades. Browser checks cover joining, returning after closure, unread state, a denied permission prompt, mobile layout, and native service-worker notification display. Live delivery through Apple/Google/Mozilla still needs a smoke test on the claimed HTTPS deployment.

Other features #

  • 🌙 Specials-board look: marker on a tiled whiteboard, chalkboard in dark mode (follows system preference)
  • 💳 Cook payment profile (IBAN / PayPal)
  • 📱 Responsive design
  • ⚡ Real-time updates via WebSocket subscriptions