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

@faurya/affiliate

v0.2.0

Published

Free React and Next.js affiliate dashboard components for Faurya users with referral links and commission helpers.

Readme

Faurya Affiliate

React components and server helpers for building affiliate dashboards with Faurya data.

@faurya/affiliate provides dashboard UI, referral-link helpers, lightweight auth helpers, commission display utilities, and Next.js App Router adapters. It is source-available and free to use for Faurya users.

Your application remains responsible for affiliate records, attribution rules, billing events, approvals, accounting, disputes, and payouts. Faurya is primarily an analytics and attribution platform; this package does not operate an affiliate program or payment service for you.

Install

For Next.js projects, the setup command is the fastest path:

npx @faurya/affiliate setup --email [email protected]

The command creates /affiliate/login, /affiliate/signup, /affiliate/dashboard, /api/auth/* route handlers, and required .env.local values.

Useful options:

npx @faurya/affiliate setup --email [email protected] --brand "Acme Partners"
npx @faurya/affiliate setup --email [email protected] --skip-install
npx @faurya/affiliate setup --email [email protected] --force

Manual install:

npm install @faurya/affiliate react react-dom

Install next only when using the Next.js adapters.

Environment

Minimum fixed-invite configuration:

[email protected]
FIXED_USER_PASSWORD_HASH=scrypt\$...
MAGIC_LINK_SECRET=change-me-to-a-random-secret-at-least-32-bytes-long
SESSION_SECRET=change-me-to-a-random-secret-at-least-32-bytes-long
APP_URL=https://your-app.com
AUTH_REDIRECT_PATH=/dashboard
AFFILIATE_REFERRAL_SECRET=change-me-to-a-random-secret-at-least-32-bytes-long

Optional public signup:

AFFILIATE_PUBLIC_SIGNUP_ENABLED=true
AFFILIATE_SIGNUP_SECRET=change-me-to-a-random-secret-at-least-32-bytes-long
AFFILIATE_ONBOARDING_FORM_URL=https://forms.example.com/affiliate-onboarding

Optional Cloudflare Turnstile protection for auth forms:

AFFILIATE_TURNSTILE_ENABLED=true
AFFILIATE_TURNSTILE_SITE_KEY=0x4AAAA...
AFFILIATE_TURNSTILE_SECRET_KEY=0x4AAAA...

Turnstile is enabled automatically when both keys are set. Set AFFILIATE_TURNSTILE_ENABLED=false to turn it off without removing keys.

Optional Redis-backed rate limiting for auth routes:

AFFILIATE_RATE_LIMIT_ENABLED=true
AFFILIATE_RATE_LIMIT_REDIS_URI=rediss://default:password@host:6379/0
AFFILIATE_RATE_LIMIT_MAX_REQUESTS=3
AFFILIATE_RATE_LIMIT_WINDOW_MS=60000

Rate limiting is optional and only active when AFFILIATE_RATE_LIMIT_REDIS_URI is set. Defaults are tight: 3 attempts per minute. Set AFFILIATE_RATE_LIMIT_ENABLED=false to turn it off without removing the URI. REDIS_URL is also accepted as an alias.

Optional Faurya API integration:

FAURYA_API_KEY=your-faurya-api-key
FAURYA_API_BASE_URL=https://api.faurya.com

Keep secrets and password hashes server-only. In Next.js .env files, escape $ in scrypt hashes as \$.

Quick example

import { AffiliateDashboard } from '@faurya/affiliate';

export function PartnerDashboard({ visitor }: { visitor: any }) {
  return (
    <AffiliateDashboard
      brandName="Acme Partners"
      userEmail="[email protected]"
      visitor={visitor}
      theme={{ primary: '#2563eb', radius: 20 }}
    />
  );
}

Package exports

| Import | Use | | --- | --- | | @faurya/affiliate | Browser-safe React components. | | @faurya/affiliate/react | Same React components. | | @faurya/affiliate/server | Server-only auth, API, referral, and commission helpers. | | @faurya/affiliate/next | Next.js route handlers. |

Do not import server or Next.js helpers from client components.

Features

  • Embeddable affiliate dashboard and login components.
  • Custom branding, labels, themes, metrics, charts, and render hooks.
  • Referral-link generation with optional HMAC signatures.
  • Display-only commission calculations using integer cents and basis points.
  • Server-only Faurya visitor API client.
  • Optional fixed-user password, magic-link, and public-signup auth helpers.
  • Next.js App Router route-handler adapters.

What is not included

This package does not create a database, process payouts, store paid/unpaid status, replace your app's user system, or expose server secrets to the browser.

Site owners are responsible for their own affiliate terms, payment decisions, taxes, refunds, fraud review, data backups, security, and disputes with affiliates or users. Displayed commission values are informational until approved by the site owner.

Documentation

Development

npm install
npm run dev

Before publishing:

npm test
npm run typecheck
npm run build
npm run build:example
npm pack --dry-run

License and terms

This package is free to use and build on for Faurya users, subject to the license and terms.

It may not be used to clone Faurya, replicate this package as a standalone affiliate SaaS, or build a competing analytics, attribution, referral-tracking, affiliate-dashboard, or affiliate-SaaS product.