npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@onairtattoo/booking

v0.6.0

Published

Generic booking engine for tattoo studios, dental clinics, vets, repair shops, salons. Framework-agnostic schema + pure engine (slot calc, recurrence, conflicts, status) + (WIP) Hono routes + email templates.

Readme

@onairtattoo/booking

Generic booking engine for service businesses (tattoo studios, vets, repair shops, salons, clinics). Framework-agnostic.

Status

v0.5.0engine + validators + cancel tokens + email templates + reminders shipped, routes / iCal still WIP.

What works today:

  • Pure slot availability calculator (calculateAvailableSlots, calculateUnavailableDays)
  • Recurrence expansion (expandRecurrence) — single / range / weekly / monthly with month-end clamping
  • Interval overlap detection (isOverlap, findConflicts)
  • Booking status state machine (canTransition, isTerminal)
  • Drizzle schema for provider, service, booking, scheduleBlock
  • Zod validators for HTTP APIs (booking / provider / service / scheduleBlock create+update, slot query, id param) — flat createScheduleBlockSchema for HTTP plus discriminated recurrencePatternSchema for direct engine input
  • Cancel-token helpers (generateCancelToken, buildCancelTokenExpiry, isCancelTokenValid, canCancelBooking) + computeRefundEligibility. 256-bit URL-safe tokens with timing-safe comparison.
  • HTML email templates. EmailTheme interface + DARK_THEME / LIGHT_THEME presets, 8 building-block functions (emailWrapper, emailHeader, emailDivider, emailParagraph, emailGreeting, emailTable, emailButton, emailFooter), and 4 opinionated builders (buildBookingConfirmationEmail, buildStatusUpdateEmail, buildReminderEmail, buildReviewRequestEmail) returning { subject, html }. All user-controlled input is HTML-escaped automatically. No copy embedded — the consumer passes every user-facing string.
  • NEW v0.5.0: reminder scheduling. getDueReminders({ candidates, schedule, now }) returns the list of reminders due to fire right now, sorted by booking time ascending. Idempotent (skips reminders already in remindersSent), catch-up friendly (fires up until bookingAt), skips terminal bookings. markReminderSent(remindersSent, minutesBefore, now) returns a new immutable array. Plus buildReminderEmail as a semantic alias for the confirmation template.

What's coming:

  • Hono router factory (configurable per consumer)
  • iCal feed generator
  • Duration-aware slot calculator (extend calculateAvailableSlots to handle variable booking durations)

Install

npm install @onairtattoo/booking drizzle-orm

drizzle-orm >= 0.45.2 is a required peer. hono and zod are optional peers (only needed once you consume the (future) routes / validators).

Usage

import { calculateAvailableSlots, expandRecurrence } from "@onairtattoo/booking";

// Pure — fetch your own data from your own DB
const slots = calculateAvailableSlots({
  candidateSlots: ["10:00", "11:00", "12:00", "17:00", "18:00", "19:00"],
  bookedRanges: [{ start: "11:00", end: "12:00" }],
  blockedRanges: [{ startTime: "17:00", endTime: "18:00" }],
  hasAllDayBlock: false,
  // Optional duration-aware mode (default duration is 60 min):
  slotDurationMin: 60,
  sessionWindows: [
    { start: "10:00", end: "13:00" },
    { start: "17:00", end: "20:00" },
  ],
});
// → ["10:00", "12:00", "18:00", "19:00"]

const dates = expandRecurrence({
  type: "weekly",
  startDate: "2026-06-01",
  endDate: "2026-06-30",
  weekdays: [1, 3], // Mon, Wed
});
// → 9 dates

For server-only imports (schema), use:

import { schema } from "@onairtattoo/booking/server";

Validators are exposed from the root and from the /validators sub-path:

import { createBookingSchema, createScheduleBlockSchema } from "@onairtattoo/booking";
// or, tree-shake-friendly:
import { createBookingSchema } from "@onairtattoo/booking/validators";

const parsed = createBookingSchema.parse(req.body);

Field naming is camelCase (matches the Drizzle schema's TS shape). Error messages are in English — translate or wrap as needed for your locale.

License

MIT