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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@explorins/pers-shared

v2.1.44

Published

Shared library for PERS applications

Readme

@explorins/pers-shared

Public Contracts Library

Pure data contracts for frontends, third-party integrations, and API consumers.

Bundle Size

  • Browser Bundle: 0.44 KB (0.30 KB gzipped)
  • Full Bundle: 0.67 KB (0.38 KB gzipped)
  • CommonJS: 1.53 KB (0.72 KB gzipped)
  • Package Size: 1.2 MB (includes all TypeScript definitions)
  • Runtime Impact: < 1 KB with tree shaking

Contents

  • DTOs - Complete API data transfer objects with validation
  • Interfaces - TypeScript contracts for authentication, users, campaigns, transactions
  • Types & Enums - Authentication types, error codes, transaction statuses
  • Value Objects - Immutable data structures (Address, StructuredError)
  • Error Classes - Structured domain errors (AuthenticationRequiredError, etc.)

Critical Build Configuration

SWAGGER COMPATIBILITY ISSUE: This library requires "moduleResolution": "node16" in tsconfig.json to prevent circular dependency errors with NestJS Swagger. Using "node" caused 3 days of debugging for Swagger generation failures.

{
  "compilerOptions": {
    "moduleResolution": "node16", // CRITICAL: Required for Swagger compatibility
    "target": "ES2022",
    "module": "CommonJS"
  }
}

Architecture

Public Contracts (this library) vs Private Patterns (pers-shared-patterns):

  • Public: Pure DTOs, interfaces, types safe for external consumption
  • Private: Business logic, database schemas, internal patterns

Usage

npm install @explorins/pers-shared

Backend/Node.js

import { 
  UserDTO, 
  TransactionStatus, 
  AuthenticationRequiredError,
  PasskeysAuthRequestDTO 
} from '@explorins/pers-shared';

// Type-safe API requests
const authRequest: PasskeysAuthRequestDTO = {
  authToken: "external_provider_jwt_token"
};

// Structured error handling
try {
  const user = await authenticate(authRequest);
} catch (error) {
  if (error instanceof AuthenticationRequiredError) {
    console.error('Authentication failed:', error.code);
  }
}

Frontend/Browser (Ultra-Light)

// Browser-optimized import - Tree-shaken to 0.44 KB!
import { UserDTO, CampaignDTO, Address } from '@explorins/pers-shared/browser';

// React example with full type safety
interface UserBalanceProps {
  user: UserTokenBalancesDTO;
}

const UserBalance: React.FC<UserBalanceProps> = ({ user }) => (
  <div>
    <h2>{user.email}</h2>
    <p>Wallet: {user.walletAddress?.getValue()}</p>
  </div>
);

🔧 Build System & Performance

  • Dual Builds: CommonJS (Node.js) + ESM (browsers) with automatic selection
  • Exceptional Tree Shaking: 99.9%+ elimination (1.2 MB package → 0.44 KB runtime)
  • Zero Runtime: Pure type definitions with no execution overhead
  • Framework Agnostic: React, Vue, Angular, vanilla JS, Node.js

🎯 Key Benefits

  • Type Safety: Catch API integration errors at compile time
  • Developer Experience: Full IntelliSense and auto-completion
  • Performance: Exceptional tree-shaking (1.2 MB → 0.44 KB runtime)
  • Reliability: Contracts match exact PERS API specifications