AppStars

Knowby, 2022 to now

Knowby scheduling: recurring work, assigned to people, live on every device.

Knowby's scheduling system lets a supervisor assign one or more guides to people on a recurring schedule, such as a daily pre-start check or a monthly inspection. Each person sees their occurrences on a calendar, gets a calendar invite, and does the work in the app. We designed, architected and developed the Knowby platform, from the mobile apps to the backend services, and scheduling runs through all of it.

Owner
Knowby
Industry
Work instructions for manufacturing, logistics and utilities
Services
SaaS platforms, mobile apps, real-time data
Platforms
.NET 10, PostgreSQL, Server-Sent Events, SwiftUI on iOS, React on the web, iCalendar
Our role
We designed, architected and developed the Knowby platform, from the mobile apps to the backend services, including scheduling on the server, the web and iOS.

The challenge

Frontline work runs on routine. A forklift is checked before every shift. A cool room is inspected each week. Fire equipment is tested once a month. Knowby already held the guides for those jobs; customers needed a way to say who does which guide, and when, and to see whether it was done.

Recurring schedules are harder than they look. "The last day of every third month" and "the second Tuesday of each month" both have to be right. Time zones and daylight saving move the clock. A daily schedule that runs for years would be millions of rows if each occurrence were stored. Changes have to reach the people affected quickly, without flooding everyone else. And workers often check their schedule where there's no signal.

Our approach

We stored the rule, not the occurrences. A schedule is one row: a start time, a duration, a time zone, a recurrence rule, the guides and the people. Occurrences are computed when they're read, for the window the reader asks for. A schedule with a hundred occurrences is still one row, and changing it is one write. Only the work done against an occurrence (a task, and the form session behind it) is stored, linked to the schedule and to the start time of the occurrence it belongs to.

Then we made correctness and freshness separate jobs, as we do across the platform. Every resource carries an entity tag, so a client always knows whether what it holds is current. A change stream only tells clients when to look again. The stream makes the screen timely; the tag makes it right. That's the core of our real-time data work.

What we built

Recurrence rules that match the calendar

Schedules can repeat daily, weekly, monthly or yearly, at any interval, ending on a date or after a number of occurrences. Weekly schedules pick days of the week. Monthly ones pick a day of the month, or a position such as "the second Tuesday". A day of the month the month doesn't have, such as the 31st, falls on the month's last day. Every schedule is described back to people in plain words, and every edit is written up as a list of what changed.

Calendar invites that stay in step

When people are assigned, they get an email with an iCalendar invite carrying the same rule as an RRULE, so the series appears correctly in Outlook, Google Calendar or Apple Calendar. Updates send a new sequence number and a summary of what changed; people removed from a schedule get a cancellation. Members who have only a phone number, and no email, are fully supported: the schedule saves and reads correctly, and the validator only rejects a person with neither.

A bounded read window

Because occurrences are computed, the window a client asks for is what bounds the response. The server refuses any window longer than 32 days. That's a month plus room for daylight saving: a 31-day cap would have refused a full October in some time zones, where the month is an hour longer. Clients read one calendar month at a time.

One event per person per write

Schedule, task and session writes announce themselves on Knowby's change stream, which is PostgreSQL LISTEN/NOTIFY relayed to clients over Server-Sent Events. Each event is addressed to the people a change concerns (the requester and each assignee) and never to the whole organisation, so a large customer's streams stay quiet. The rule is one event per person per write: a requester who is also an assignee gets one event, not two, and a schedule update that cancels many tasks sends a single invalidation to each person affected. A failed notification never fails the write.

My Schedules on iOS, offline

On iPhone and iPad, a native month calendar marks the days with work, and the list beneath scrolls to the day you tap. Each month read is cached for good and revalidated by its entity tag, so a month you've seen opens offline. Each occurrence shows its state: upcoming, overdue, in progress, completed, completed late or cancelled, worked out from the work held on the device as well as the server's copy. "Add to Calendar" uses the system event editor, for one occurrence or the whole series.

Architecture

Rules on the server, occurrences on read, changes on a stream.

  1. ScheduleOne row: rule, time zone, guides and people
  2. Occurrence expansionComputed for the requested window, 32 days at most
  3. Tasks and sessionsThe work done, linked to an occurrence's start
  4. LISTEN/NOTIFY to SSEOne event to each person a write concerns
  5. ClientsiOS calendar, web and email invites, kept current by entity tags

The stream carries no data. A missed event only makes a client later to look again; the entity tag keeps it correct.

Results

Under the hood

Rules, streams and tags across server and clients.

What we'd do now

Store the rule, compute the occurrences. Pre-generating every occurrence looks simpler until someone edits a series that runs for five years. Keep one source of truth for the pattern, expand it on read within a bounded window, and store only the facts that happen against an occurrence. Your writes stay small and your edits stay atomic.

Bound every read. An unbounded "show me all future occurrences" is a denial-of-service you wrote yourself. Pick a window that matches how people actually look (a month), allow for daylight saving, and enforce it on the server, not only in the date picker.

Address events to people, not organisations. Broadcasting every change to everyone works for ten users and fails at ten thousand. Scope each notification to the people it concerns, deduplicate per person, and make the stream a hint that clients act on through cached, tagged reads. Next, we'd add reminder push notifications driven by each schedule's "notify before" setting, and server-side time-zone tests for every recurrence type across daylight-saving changes.

Why it matters now

Rostering, inspections, maintenance and compliance checks all come down to recurring work, assigned to people, that must be visible and provable. We build that as part of SaaS platforms and mobile and field apps, with real-time updates that stay correct when the signal drops.

Scheduling ties the rest of the Knowby platform together: a guide is assigned, done as a form in the field, and filed as a PDF.

Questions

What does Knowby's scheduling system do?

It lets a supervisor assign guides to people on a one-off or recurring schedule. Assignees get a calendar invite, see their occurrences in the app and complete the work as a tracked task.

How are recurring schedules stored?

As one row holding the recurrence rule. Occurrences are computed when a client reads a window of up to 32 days, and only the work done against an occurrence is stored.

How do changes reach people's devices?

PostgreSQL LISTEN/NOTIFY, relayed over Server-Sent Events, sends one event to each person a change concerns. Clients then revalidate their cached data with entity tags.

Can you build scheduling into our product?

Yes. We design recurrence, time-zone handling, calendar invites, live updates and offline calendars as part of web and mobile platforms.

Related

The services behind this work, and more stories like it.

Services

Case studies

Bring us the hard problem.

A 45-minute discovery call with the engineer who'll build it.