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

@teamlunaris/easypoints-hydrogen

v0.1.0

Published

Headless React building blocks and a server-side client to integrate the easyPoints loyalty program into Shopify Hydrogen storefronts.

Downloads

1,143

Readme

@teamlunaris/easypoints-hydrogen

npm GitHub Packages JSR License: GPL-3.0

Headless React building blocks and a server-side client that integrate the easyPoints loyalty program into Shopify Hydrogen storefronts.

  • Server loyalty client: holds the API token, runs in Hydrogen loaders/actions, talks to the easyPoints REST API and reads loyalty data from Shopify metafields.
  • React hooks + provider: cart points, redemption, tier progress, customer loyalty.
  • Headless (unstyled) components: render-prop building blocks; you own all markup and styles.
  • TypeScript types: validated at the trust boundary with Valibot and exported for consumers.

Install

Use whichever package manager your Hydrogen app uses:

npm install @teamlunaris/easypoints-hydrogen
pnpm add @teamlunaris/easypoints-hydrogen

Peer dependencies, provided by your Hydrogen app: @shopify/hydrogen, react, react-router (and react-dom if your usage needs it).

Requirements: Hydrogen 2026.x · React Router 7.12+ · React 19 · Node ≥ 22.13.

Entry points

The package splits along the browser/server trust boundary. Respect it:

| Import | Environment | Contents | | ----------------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------- | | @teamlunaris/easypoints-hydrogen | browser + SSR | isomorphic: domain types, tier logic, and the headless render-prop components | | @teamlunaris/easypoints-hydrogen/client | browser + SSR | React hooks (useCartPoints, useCartRedemption, useTierProgress, useCustomerLoyalty) + EasyPointsProvider | | @teamlunaris/easypoints-hydrogen/server | server only | loyalty client (createEasyPointsClient), cart-points route action, product/customer/shop queries, GraphQL fragments | | @teamlunaris/easypoints-hydrogen/types | types only | TypeScript types for loyalty data |

The /server entry holds EASY_POINTS_API_TOKEN and throws if imported in the browser. Never import it from client code. The root and /client entries are safe everywhere.

Quickstart

The wiring is four steps. See the getting-started guide for the full walkthrough and examples/storefront for a complete working app.

1. Mount the client on the Hydrogen context (app/lib/context.ts): add it to the additional-context object passed to createHydrogenContext(...), then init() it:

import {
  createEasyPointsClient,
  type EasyPointsClient,
} from "@teamlunaris/easypoints-hydrogen/server";

interface LoyaltyContext {
  loyalty: EasyPointsClient;
}

declare global {
  interface HydrogenAdditionalContext extends LoyaltyContext {}
  interface Env {
    EASY_POINTS_API_TOKEN?: string;
    EASY_POINTS_API_ENDPOINT?: string;
  }
}

const additionalContext: LoyaltyContext = {
  loyalty: createEasyPointsClient({
    cache,
    waitUntil,
    request,
    token: env.EASY_POINTS_API_TOKEN ?? "",
    endpoint: env.EASY_POINTS_API_ENDPOINT, // optional, defaults to https://loyalty.slrs.io/api
  }),
};

const hydrogenContext = createHydrogenContext(
  {
    /* env, request, cache, session, cart… */
  },
  additionalContext,
);
hydrogenContext.loyalty.init(hydrogenContext); // bind storefront + customer-account handles
return hydrogenContext;

2. Add the cart-points resource route at /api/cart/points (app/routes/api.cart.points.tsx). Import /server at module scope. React Router's automatic code splitting removes server-only route exports (action/loader) — and their now-unused imports — from the client bundle, so /server never reaches the browser and its server-only guard never runs there:

import { createCartPointsAction } from "@teamlunaris/easypoints-hydrogen/server";

import type { Route } from "./+types/api.cart.points";

export async function action(args: Route.ActionArgs) {
  const handleAction = createCartPointsAction(); // optional `lineFilter` to exclude cart lines
  return handleAction<Route.ActionArgs>(args);
}

3. Wrap your app in the provider (app/root.tsx) to share currency + route config:

import { EasyPointsProvider } from "@teamlunaris/easypoints-hydrogen/client";

<EasyPointsProvider currencyCode="USD">{/* app */}</EasyPointsProvider>;

4. Render headless components / use hooks. All components are unstyled and expose data via render props; the markup is yours:

import { CustomerLoyalty, TierProgress, CartRedemption } from "@teamlunaris/easypoints-hydrogen";
import { useCartPoints } from "@teamlunaris/easypoints-hydrogen/client";

<CustomerLoyalty loyalty={loyalty}>
  {({ balance, tier }) => (
    <p>
      {balance} pts · {tier?.name}
    </p>
  )}
</CustomerLoyalty>;

const { totalPoints } = useCartPoints(cart);

Documentation

  • Getting started: step-by-step Hydrogen integration.
  • examples/storefront: a complete Hydrogen app using every entry point.
  • API reference: published to JSR, generated from the source doc comments.

License

GPL-3.0-only