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

@wiest-digital/daybook-client

v0.1.1

Published

Client SDK for the Daybook content API: typed content fetching, lead submission, and a canonical prose stylesheet for building websites backed by Daybook.

Readme

@wiest-digital/daybook-client

Client SDK for the Daybook content API. Everything a website needs to pull Daybook-managed content and send leads back, so we stop re-carving the same fetch/auth/types/CSS on every client site.

Framework-agnostic (pure fetch + types + a plain stylesheet). Works in Astro, Next, or anything with fetch. It is plumbing, not UI — it hands you clean, typed, validated data; you own the design.

What's in the box

  • createClient — typed getters for content blocks, blog posts, and galleries, with Bearer auth, locale handling, response validation (zod), and a graceful-degradation contract (lists → [], items → null on failure, so a page never crashes).
  • submitLead — server-side lead submission to the ingest endpoint (JSON or multipart-with-photos), with the token + source URL owned server-side.
  • prose.css — the canonical stylesheet for CMS-delivered HTML. Restores the block-node structure resets strip (heading sizes, list markers, blockquotes), inheriting each site's font and color.

Install

Until it's on npm, install from the repo:

npm i github:Wiest-Digital/daybook-client

Once published: npm i @wiest-digital/daybook-client.

Content

import { createClient } from '@wiest-digital/daybook-client';

const daybook = createClient({
  contentApiUrl: import.meta.env.CONTENT_API_URL, // https://.../api/content
  token: import.meta.env.CONTENT_API_TOKEN,
  defaultLocale: 'en',
});

const posts = await daybook.posts();               // PostSummary[]
const post = await daybook.post('my-slug');        // Post | null
const galleries = await daybook.galleries();       // GallerySummary[]
const gallery = await daybook.gallery('brick');    // Gallery | null
const blocks = await daybook.blocks();             // Record<key, ContentBlock>
const banner = await daybook.block('sale-banner'); // ContentBlock | null

Render the sanitized HTML into a .daybook-prose element:

---
import '@wiest-digital/daybook-client/prose.css';
const post = await daybook.post(Astro.params.slug);
---
{post && <div class="daybook-prose" set:html={post.body_html} />}

Failures are logged (override with onError) and return the safe empty value — so a missing block or a down API degrades gracefully instead of 500-ing.

Leads

Call server-side (an API route / action), never from the browser:

import { submitLead } from '@wiest-digital/daybook-client';

// Simple JSON form:
await submitLead(
  { ingestUrl: import.meta.env.CRM_INGEST_URL, ingestToken: import.meta.env.CRM_INGEST_TOKEN },
  { fields: { name, email, phone, message }, sourceUrl: request.headers.get('referer') ?? undefined }
);

// Multipart pass-through (photo uploads) — forward the inbound FormData:
await submitLead(config, { form: await request.formData(), sourceUrl: referer });

New-site checklist

  1. npm i github:Wiest-Digital/daybook-client (or the npm version).
  2. Set env vars in the Vercel project (Production scope; preview won't have them):
    • CONTENT_API_URLhttps://<tenant-dashboard>/api/content
    • CONTENT_API_TOKEN — the tenant's content token (from the CRM admin → client)
    • CRM_INGEST_URL / CRM_INGEST_TOKEN — if the site captures leads
  3. createClient(...) once; call the getters in your pages (SSR / prerender = false or ISR so edits appear without a rebuild).
  4. import '@wiest-digital/daybook-client/prose.css' once; add class="daybook-prose" wherever you set:html CMS content. Layer brand tweaks on top.
  5. Route the contact form through submitLead server-side.

Publishing to npm (first time — Derrick)

  1. Create the org once (free): npmjs.com → Add Organizationwiest-digital. (If you pick a different name, update the name scope in package.json.)
  2. npm login as a member of that org.
  3. npm publishpublishConfig.access is already public; prepublishOnly rebuilds dist.
  4. Bump each consuming site off the git dep: npm i @wiest-digital/daybook-client@^0.1.1.

Develop

npm install
npm run build      # tsc -> dist/ (committed so the git dep needs no build step)
npm test           # vitest

dist/ is committed on purpose: it lets sites install this straight from GitHub (no build step at install time) before it's on npm.

License: UNLICENSED (proprietary; source-available for our own sites).