Skip to content

Apiary

Zero-dependency, framework-agnostic scheduling primitives for the web.

Apiary is a TypeScript-first scheduling library you can embed in any modern web application or backend service. It is built entirely on Web Standard APIs — Date, Intl, Request / Response, fetch — with no framework coupling and no required compilers.

Dynamic rules

Generate operating windows from weekly recurring rules, then subtract buffers, blackouts, and existing bookings to produce bookable slots.

Explicit shifts

Block time by default and only generate slots inside admin-approved, database-stored shift records.

Timezone safe

Wall-clock rules convert to exact UTC instants through Intl, with daylight-saving transitions handled per day.

Race-proof

The PostgreSQL adapter enforces double-booking prevention with GIST exclusion constraints at the database level.

Zero dependencies

@apiary/core ships with no runtime dependencies — bundled ESM/CJS with types, also available on JSR.

Headless UI

Calendar matrix builders give you month, week, and multi-week grids with padding, blocking, and day metadata — bring your own components.

Availability flows through two pure steps:

  1. Windows — spans of time that could be bookable (AvailableWindow[]).
    • Dynamic mode: expanded from weekly recurring rules via expandWeeklyRules.
    • Explicit mode: stored, admin-published shift records.
  2. Slots — generateTimeSlots carves a window into candidate slots, then marks each one available or not by applying buffers, minimum notice, the booking horizon, and collisions with existing bookings and holds.

The PostgreSQL adapter turns this into a full booking backend with atomic holds and confirmation, while the pure core stays framework- and storage-agnostic.