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

@boostengine/loyalty

v1.1.0

Published

Enterprise-grade Loyalty Engine — SuperCoins, VIP Tiers, Gamification, Challenges & AI Agent Toolkit for Next.js, Vite, React, and Node.js.

Readme

@boostengine/loyalty 🪙

npm version npm downloads License: MIT TypeScript Tree Shakable

Flipkart SuperCoins & Amazon Pay style loyalty rewards, tier progression & checkout redemptions for Next.js, Vite, React, and Node.js.

Retain high-value customers by rewarding every purchase with redeemable coins, VIP tiers, and instant discount slider redemptions at checkout.


🌟 Features

  • 🏆 Dynamic VIP Tiers: Automatic progression (BronzeSilverGoldSuperStar) based on lifetime earned coins.
  • 💸 Fair Redemption Caps: Built-in maximum redemption rules (e.g. up to 20% of cart value can be paid with coins).
  • 🎁 Tier Perks Engine: Automatic multipliers for VIPs (1.5x, 2x coins per purchase), free express shipping flags, and early access sales.
  • 🚀 Universal Compatibility: Works out-of-the-box in Next.js (Server & Client), Vite, Express, and React Native.

📐 VIP Tiers & Perks Matrix

| Tier | Lifetime Coins | Multiplier | Free Express Delivery | Early Access Deals | Cashback % | |---|:---:|:---:|:---:|:---:|:---:| | Bronze | 0 - 199 | 1.0x | ❌ | ❌ | 1% | | Silver | 200 - 499 | 1.2x | ❌ | ❌ | 2% | | Gold | 500 - 999 | 1.5x | ✅ | ✅ | 3% | | SuperStar | 1000+ | 2.0x | ✅ | ✅ | 5% |


📦 Installation

npm install @boostengine/loyalty
# or
yarn add @boostengine/loyalty
# or
pnpm add @boostengine/loyalty

⚡ 60-Second Quickstart

import { LoyaltyEngine } from '@boostengine/loyalty';

// 1. Calculate coins earned on an order
const coinsEarned = LoyaltyEngine.calculateCoinsEarned(
  2499,      // Order total in ₹
  'SuperStar' // Customer VIP Tier (2x multiplier)
);
console.log(coinsEarned); // 98 SuperCoins

// 2. Calculate Checkout Redemption Quote
const quote = LoyaltyEngine.calculateRedemption(
  2000, // Order Total
  300,  // Customer's available coins balance
  200,  // Requested coins to redeem
  'Gold'
);

console.log(quote.maxRedeemableCoins);     // 400 (Cap is 20% of ₹2000)
console.log(quote.rupeeDiscount);          // ₹200 OFF
console.log(quote.payableAfterDiscount);   // ₹1800
console.log(quote.coinsEarnedOnThisOrder); // Coins earned on remaining payable amount

// 3. Check / Update Customer Tier based on lifetime coins
const tier = LoyaltyEngine.determineTier(650);
console.log(tier); // "Gold"

🚀 Framework Integration Examples

A. Next.js App Router (Redemption API)

Create app/api/loyalty/quote/route.ts:

import { NextResponse } from 'next/server';
import { LoyaltyEngine } from '@boostengine/loyalty';

export async function POST(req: Request) {
  const { cartTotal, userBalance, requestedCoins, tier } = await req.json();

  const quote = LoyaltyEngine.calculateRedemption(
    cartTotal,
    userBalance,
    requestedCoins,
    tier
  );

  return NextResponse.json({ success: true, quote });
}

B. Vite + React (Checkout Coin Slider Component)

import React, { useState } from 'react';
import { LoyaltyEngine } from '@boostengine/loyalty';

export function CoinRedemptionBox({ orderTotal, availableCoins, tier, onApply }) {
  const quote = LoyaltyEngine.calculateRedemption(orderTotal, availableCoins, availableCoins, tier);
  const [useCoins, setUseCoins] = useState(false);

  return (
    <div className="border border-amber-200 bg-amber-50/50 p-4 rounded-2xl flex items-center justify-between">
      <div>
        <h4 className="font-bold text-sm text-gray-900">🪙 Redeem SuperCoins</h4>
        <p className="text-xs text-gray-600">
          You have {availableCoins} coins. Use up to {quote.maxRedeemableCoins} coins for ₹{quote.maxRedeemableCoins} discount.
        </p>
      </div>
      <button
        onClick={() => {
          setUseCoins(!useCoins);
          onApply(useCoins ? 0 : quote.maxRedeemableCoins);
        }}
        className="bg-black text-white text-xs font-bold px-4 py-2 rounded-xl"
      >
        {useCoins ? 'Remove' : 'Apply Coins'}
      </button>
    </div>
  );
}

📖 API Reference

LoyaltyEngine.calculateCoinsEarned(orderTotal: number, tier?: CustomerTier): number

Calculates coins awarded for a purchase based on standard ₹ spend and VIP multipliers.

LoyaltyEngine.calculateRedemption(orderTotal, availableCoins, requestedCoins?, tier?): RedemptionQuote

Evaluates checkout discount, applies the 20% order cap limit, and outputs net payable balance.

LoyaltyEngine.determineTier(lifetimeCoins: number): CustomerTier

Returns 'Bronze' | 'Silver' | 'Gold' | 'SuperStar'.

LoyaltyEngine.getTierPerks(tier: CustomerTier): TierPerks

Outputs multiplier, free shipping eligibility, and cashback rates.


📄 License

MIT © Boost Engine Team