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

@foldspace-fe/casdoor-next-auth-kit

v0.1.75

Published

[![npm version](https://img.shields.io/npm/v/@foldspace-fe/casdoor-next-auth-kit?label=npm)](https://www.npmjs.com/package/@foldspace-fe/casdoor-next-auth-kit) [![npm downloads](https://img.shields.io/npm/dm/@foldspace-fe/casdoor-next-auth-kit?label=downl

Readme

@foldspace-fe/casdoor-next-auth-kit

npm version npm downloads

面向 Next.js 的无头 Casdoor 认证与 billing 工具包。

提供:

  • 宿主站内登录、注册、回调、注销路由壳
  • 认证状态与动作的 React Provider / Hook
  • SaaS 订阅、虚拟商品、积分商品的 headless billing runtime
  • 生成和校验宿主受管文件的 CLI

安装

npm install @foldspace-fe/casdoor-next-auth-kit

也可以使用你常用的包管理器:

pnpm add @foldspace-fe/casdoor-next-auth-kit
yarn add @foldspace-fe/casdoor-next-auth-kit

快速开始

认证导入

import {
  createLoginEntryResponse,
  createSignupEntryResponse,
} from '@foldspace-fe/casdoor-next-auth-kit';

React 认证

'use client';

import {
  AuthProvider,
  useAuthSession,
  useAuthUser,
} from '@foldspace-fe/casdoor-next-auth-kit/react';

Billing runtime

import { buildBillingSubscriptionCatalog } from '@foldspace-fe/casdoor-next-auth-kit/billing';
import { BillingProvider } from '@foldspace-fe/casdoor-next-auth-kit/react';

如果宿主已经有自己的会员计划 rows,先用 buildBillingSubscriptionCatalog() 生成 subscription catalog,再把结果交给 BillingProvider。商品项仍然可以单独拼进同一个 catalog,但订阅和商品要保持语义分离。

一个可以直接复制的完整模板如下:

const membershipPlans = [
  {
    id: 'plan-basic',
    code: 'membership-monthly',
    name: 'Membership Monthly',
    level: 'BASIC',
    priceCents: 99900,
    giftPoints: 10000,
    billingCycle: 'MONTH',
    benefits: {
      faceLibrary: true,
      monthlyReports: true,
    },
  },
];

const subscriptionCatalog = buildBillingSubscriptionCatalog(membershipPlans, {
  catalogKey: 'main',
  title: 'Billing Catalog',
  mapPlan: (plan) => ({
    source: plan,
    key: plan.code,
    title: plan.name,
    description: `${plan.level} membership`,
    productId: 'qixiaoju/创小剧会员订阅',
    planId: plan.id,
    priceId: `pricing_${plan.code}`,
    interval: 'month',
    priceValue: plan.priceCents,
    metadata: {
      level: plan.level,
      giftPoints: String(plan.giftPoints),
      billingCycle: plan.billingCycle,
    },
  }),
});

const billingCatalog = {
  ...subscriptionCatalog,
  purchasableIds: [...subscriptionCatalog.purchasableIds, 'credits-50'],
  items: [
    ...subscriptionCatalog.items,
    {
      key: 'credits-50',
      kind: 'product',
      title: '50 Credits',
      description: 'One-time product used for credits or other non-recurring goods.',
      credits: 50,
      backendRef: {
        productId: 'qixiaoju/创小剧积分包-50',
        priceId: 'price_credits_50',
      },
      creditGrant: {
        creditsPerUnit: 50,
        unitName: 'credits',
      },
    },
  ],
};

如果你只是想配白名单,.env 里可以直接写:

NEXT_PUBLIC_BILLING_PURCHASABLE_IDS=membership-monthly,credits-50

Billing 动作

'use client';

import {
  useSubscribePlan,
  usePurchaseProduct,
} from '@foldspace-fe/casdoor-next-auth-kit/react';

最常用命令

npx @foldspace-fe/casdoor-next-auth-kit@latest init
npx @foldspace-fe/casdoor-next-auth-kit@latest update
npx @foldspace-fe/casdoor-next-auth-kit@latest check
npx @foldspace-fe/casdoor-next-auth-kit@latest --version

npx 会读取 package 的 bin 入口并运行 casdoor-next-auth-kit CLI。

包导出

  • @foldspace-fe/casdoor-next-auth-kit
  • @foldspace-fe/casdoor-next-auth-kit/react
  • @foldspace-fe/casdoor-next-auth-kit/billing
  • @foldspace-fe/casdoor-next-auth-kit/next

文档

npm

  • 包页面:https://www.npmjs.com/package/@foldspace-fe/casdoor-next-auth-kit
  • 发布 scope:@foldspace-fe