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

fairnight-smoobu

v0.2.1

Published

Smoobu connector for Fairnight: read apartments and bookings, write nightly prices and minimum stays through the official API (HMAC-signed).

Readme

fairnight-smoobu

The Smoobu connector of Fairnight. Hosts use it through the fairnight smoobu commands of fairnight-cli. This package is the library underneath.

Built only from Smoobu's public API documentation (docs.smoobu.com). No scraping, and no dependencies besides the Fairnight engine's types. It uses Node's own fetch.

What it does

  • Signs every request with HMAC-SHA256, as documented:

    • the canonical string is method, path, sorted RFC 3986 query, UTC timestamp, a fresh UUID v4 nonce, the SHA-256 of the body, and the key;
    • it is signed with the secret, which is never sent.

    The legacy Api-Key header is not supported: Smoobu stops accepting it on 31 October 2026.

  • Reads apartments (GET /api/apartments, /api/apartments/{id}), bookings (GET /api/reservations, every page, cancellations included) and rates (GET /api/rates).

  • Writes prices and minimum stays (POST /api/rates), always together, because Smoobu refuses a minimum stay on a date without a price.

  • Respects the limits:

    • at most 300 requests per minute of its own (Smoobu allows 700);
    • on 429, it waits until X-RateLimit-Retry-After plus one second;
    • outages (5xx without a message) are retried after 1, 2, 4 and 8 seconds;
    • validation errors (HTTP 500 with a detail) and everything else stop with a plain explanation.
  • Plans a push (planPush): the nights whose price or minimum stay differ, and the nights Smoobu marks unavailable, which are left alone.

  • Builds operations (buildOperations): one night per operation until Smoobu's handling of a range end is known; after that, runs of at most 7 equal nights.

Credentials never appear in an error message.

import { SmoobuClient } from "fairnight-smoobu";

const smoobu = new SmoobuClient({
  credentials: { apiKey: process.env.SMOOBU_API_KEY!, apiSecret: process.env.SMOOBU_API_SECRET! },
  fetch: (url, init) => fetch(url, init),
});
const apartments = await smoobu.listApartments();

Tests

Every test runs against a fake Smoobu server on 127.0.0.1. Like Smoobu, it checks:

  • the HMAC signature;
  • the timestamp, within 5 minutes;
  • that no nonce is used twice;
  • that the legacy header is absent.

Its responses follow the documented shapes. A signing test compares the signature with a value computed by hand, so a change in the recipe shows up at once. No test ever calls the real Smoobu.

License

AGPL-3.0-only. See LICENSE.