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

@borrowbetter/swsdk

v0.1.4

Published

Spinwheel credit data and debt profile SDK

Readme

@borrowbetter/swsdk

Internal use only. This package is maintained by BorrowBetter for internal projects. It is published publicly for convenience but is not intended for general use. No support or stability guarantees are provided for external consumers.

TypeScript SDK for the Spinwheel credit data and debt profile API. Provides type-safe access to user connection, debt profile fetching, and hydrated user data.

Installation

npm install @borrowbetter/swsdk

Requirements

  • Node.js >= 18
  • Spinwheel API key (provided by your Spinwheel account manager)

Quick Start

import { SpinwheelSDK } from "@borrowbetter/swsdk";

const spinwheel = new SpinwheelSDK({
  apiKey: process.env.SPINWHEEL_API_KEY,
  sandbox: process.env.NODE_ENV !== "production",
});

API

Connect

Connect a user to Spinwheel via preverified phone or network token.

// Preverified phone (requires Spinwheel support approval)
const result = await spinwheel.connect.preverifiedPhone({
  phoneNumber: "+14155552671",
  dateOfBirth: "1990-01-15",
  extUserId: "your-internal-user-id",
  audit: {
    verificationDate: "2025-01-01",
    userConsentDate: "2025-01-01",
    verificationType: "SMS",
  },
});

const { userId } = result.data;

// Network token
const result = await spinwheel.connect.networkToken({
  extUserId: "your-internal-user-id",
  networkToken: "token-from-verification",
  ssnLastFourDigits: "1234",
  dateOfBirth: "1990-01-15",
  audit: { userConsentDate: "2025-01-01" },
});

Debt Profile

Trigger an asynchronous credit pull. Results are retrieved via userManagement.get() once processing completes.

await spinwheel.debtProfile.fetch(userId, {
  creditReport: {
    sourceBureau: "TransUnion",
    type: "1_BUREAU.FULL",
  },
  creditScore: {
    sourceBureau: "TransUnion",
    model: "VANTAGE_SCORE_3_0",
  },
});

Note: Your implementation must display the Spinwheel End User Agreement before calling this method.

User Management

Retrieve a user's full hydrated profile including all liabilities and credit reports. Always uses the secure endpoint with unmasked account number and SSN.

// By Spinwheel user ID
const { data } = await spinwheel.userManagement.get({ userId });

// By your external user ID
const { data } = await spinwheel.userManagement.get({ extUserId: "your-id" });

// Available on the hydrated user
data.profile?.creditScore;
data.creditCardSummary;
data.personalLoanSummary;
data.autoLoanSummary;
data.homeLoanSummary;
data.studentLoanSummary;
data.creditReports;
data.creditCards;
data.personalLoans;
data.autoLoans;
data.homeLoans;
data.studentLoans;
data.miscellaneousLiabilities;

Configuration

new SpinwheelSDK({
  apiKey: string;    // Required — your Spinwheel API key
  sandbox?: boolean; // Optional — defaults to false (production)
});

Response Shape

All methods return Spinwheel's standard response envelope:

interface SpinwheelResponse<T> {
  status: {
    code: number;
    desc: string;
    messages?: Array<{ desc: string; type?: "ERROR" | "WARN" | "INFO" }>;
  };
  data: T;
}
const result = await spinwheel.connect.preverifiedPhone({ ... });

if (result.status.code >= 400) {
  console.error(result.status.messages);
  return;
}

const { userId } = result.data;

Type Exports

All types are exported directly from the package:

import type {
  SpinwheelConfig,
  HydratedUserData,
  UserData,
  CreditReport,
  CreditCard,
  PersonalLoan,
  AutoLoan,
  HomeLoan,
  StudentLoan,
  LiabilityType,
  CreditBureau,
  // ...and more
} from "@borrowbetter/swsdk";

Development

npm install
npm run dev        # tsup watch mode
npm run build      # compile to dist/
npm run typecheck  # TypeScript check
npm run lint       # Biome lint
npm run format     # Biome format + auto-fix
npm run smoke      # Run smoke test against sandbox

Smoke Test

cp .env.example .env.local
# Add SPINWHEEL_API_KEY to .env.local
npm run smoke

Scripts

| Script | Description | |--------|-------------| | npm run build | Compile to dist/ | | npm run dev | Watch mode | | npm run smoke | End-to-end test against sandbox | | npm run lint | Biome lint check | | npm run format | Biome format + auto-fix | | npm run typecheck | TypeScript type check |