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

@kulupay/cli

v0.0.8

Published

The CLI for KuluPay - generate schemas and migrate your database

Readme

KuluPay

A unified payment SDK for Node.js. Integrate multiple payment providers (Stripe, PayPal, Chapa, crypto) through a single API.

Features

  • Multi-provider support — Stripe, PayPal, Chapa, and crypto (viem) out of the box
  • Unified API — One interface for creating payment intents, managing customers, and handling subscriptions
  • Framework agnostic — Works with any Node.js framework (Next.js, Express, etc.)
  • Next.js integration — Built-in handler for Next.js App Router
  • React hooks — Client-side hooks for payment operations
  • Type-safe — Written in TypeScript with full type definitions
  • Pluggable — Custom provider support via the PaymentProvider interface

Packages

| Package | Description | | --- | --- | | @kulupay/core | Core logic, types, and payment provider implementations | | @kulupay/kulupay | Full SDK with server handler, client, and framework integrations | | @kulupay/cli | CLI tool for schema generation and database migration |

Quick Start

Installation

pnpm add @kulupay/kulupay
# or
npm install @kulupay/kulupay

Server-side Setup

import { kuluPay, PaymentProvider } from "@kulupay/kulupay";
import { createMemoryDriver } from "@farming-labs/orm";

const mockProvider: PaymentProvider = {
  id: "mock",
  createIntent: async (data) => ({
    id: `mock_${Date.now()}`,
    amount: data.amount,
    currency: data.currency,
    status: "pending",
    metadata: data.metadata,
  }),
  getIntent: async (id) => ({
    id,
    amount: 1000,
    currency: "USD",
    status: "succeeded",
  }),
  cancelIntent: async (id) => ({
    id,
    amount: 1000,
    currency: "USD",
    status: "canceled",
  }),
};

export const pay = kuluPay({
  database: createMemoryDriver(),
  providers: [mockProvider],
  baseURL: "http://localhost:3000/api/pay",
});

Next.js Integration

// app/api/pay/[...kulupay]/route.ts
import { toNextJsHandler } from "@kulupay/kulupay/next-js";
import { pay } from "@/lib/pay";

export const { GET, POST, PUT, PATCH, DELETE } = toNextJsHandler(pay);

Client-side (React)

import { usePayment } from "@kulupay/kulupay/client";

function Checkout() {
  const { createIntent, loading, error } = usePayment({
    baseURL: "/api/pay",
    providerId: "mock",
  });

  const handlePay = async () => {
    const intent = await createIntent({
      amount: 1000,
      currency: "USD",
      userId: "user_123",
      providerId: "mock",
    });
    console.log(intent);
  };

  return (
    <button onClick={handlePay} disabled={loading}>
      {loading ? "Processing..." : "Pay $10"}
    </button>
  );
}

Client-side (Vanilla)

import { createKuluPayClient } from "@kulupay/kulupay/client";

const client = createKuluPayClient({
  baseURL: "/api/pay",
  providerId: "mock",
});

const intent = await client.createIntent({
  amount: 1000,
  currency: "USD",
  userId: "user_123",
  providerId: "mock",
});

Built-in Providers

  • Stripe@kulupay/core/payment-providers
  • PayPal@kulupay/core/payment-providers
  • Chapa@kulupay/core/payment-providers
  • Crypto (viem)@kulupay/core/payment-providers

Custom Providers

Implement the PaymentProvider interface:

import type { PaymentProvider } from "@kulupay/core";

const myProvider: PaymentProvider = {
  id: "my-provider",
  createIntent: async (data) => { /* ... */ },
  getIntent: async (id) => { /* ... */ },
  cancelIntent: async (id) => { /* ... */ },
};

Custom Schema Fields

KuluPay allows you to add custom fields to the payment, customer, and subscription tables without modifying the core SDK:

export const pay = kuluPay({
  database: prisma,
  providers: [stripe({ apiKey: "sk_..." })],

  payment: {
    modelName: "payments", // rename table
    additionalFields: {
      description: { type: "string", required: false },
      receiptEmail: { type: "string", required: false },
    },
  },

  customer: {
    additionalFields: {
      country: { type: "string", required: false },
      telegramId: { type: "string", required: false, unique: true },
    },
  },

  subscription: {
    additionalFields: {
      trialEnd: { type: "datetime", required: false },
    },
  },
});

Supported field types: string, number, boolean, datetime, json.

CLI

KuluPay provides a CLI tool for generating database schema files and migrating your database:

# Generate a Prisma schema
npx @kulupay/cli generate --generator prisma --dialect postgresql

# Generate a Drizzle schema
npx @kulupay/cli generate --generator drizzle --dialect pg

# Generate raw SQL
npx @kulupay/cli generate --generator sql --dialect postgres

# Push schema to database
npx @kulupay/cli migrate

CLI Options

| Option | Description | | --- | --- | | --config <path> | Path to your KuluPay config file | | --output <path> | Output file path for generated schema | | --generator <type> | Schema generator: prisma, drizzle, or sql | | --dialect <type> | Database dialect: postgresql, mysql, or sqlite | | -y, --yes | Skip confirmation prompts |

Testing

KuluPay uses Vitest for testing. Tests run against source files directly (no build needed).

# Run all tests
pnpm test

# Run tests for a specific package
pnpm --filter @kulupay/core test

# Watch mode
pnpm --filter @kulupay/core test:watch

Contributing

See CONTRIBUTING.md for development setup and guidelines.

License

MIT