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

@paanj/admin

v1.0.4

Published

Core admin SDK for Paanj platform - provides authentication and connection management

Readme

@paanj/admin

Core admin SDK for Paanj platform - provides authentication and connection management

npm version License Node.js

⚠️ Server-Side Only

This SDK is designed exclusively for server-side use. It requires a secret API key and should never be exposed to client-side code or browsers.

Overview

@paanj/admin is the core package that provides:

  • 🔐 Authentication - Secret key-based authentication
  • 🔌 Connection Management - WebSocket and HTTP client infrastructure
  • 🔄 Auto-Reconnection - Built-in reconnection with exponential backoff
  • 🎯 Base for Feature Packages - Foundation for @paanj/chat-admin, @paanj/voice-admin, etc.

Installation

npm install @paanj/admin

Requirements:

  • Node.js 18.0.0 or higher
  • Server-side environment only

Usage

Standalone Usage

import { PaanjAdmin } from '@paanj/admin';

const admin = new PaanjAdmin('sk_live_your_secret_key', {
  apiUrl: 'http://localhost:3000',
  wsUrl: 'ws://localhost:8090'
});

// Connect to WebSocket
await admin.connect();

// Check connection status
console.log(admin.isConnected()); // true

// Disconnect
admin.disconnect();

With Feature Packages

The core package is typically used with feature packages:

import { PaanjAdmin } from '@paanj/admin';
import { AdminChat } from '@paanj/chat-admin';

const admin = new PaanjAdmin('sk_live_your_secret_key');
await admin.connect();

// Initialize chat features
const chat = new AdminChat(admin);
chat.messages.onCreate((msg) => {
  console.log('New message:', msg);
});

API Reference

PaanjAdmin

Constructor

new PaanjAdmin(secretKey: string, options?: AdminOptions)

Options:

  • apiUrl?: string - API server URL (default: http://localhost:3000)
  • wsUrl?: string - WebSocket server URL (default: ws://localhost:8090)
  • autoReconnect?: boolean - Enable auto-reconnection (default: true)
  • reconnectInterval?: number - Reconnect interval in ms (default: 5000)
  • maxReconnectAttempts?: number - Max reconnect attempts (default: 10)

Methods

connect(): Promise<void>
Connect to the WebSocket server.

disconnect(): void
Disconnect from the WebSocket server.

isConnected(): boolean
Check if connected to WebSocket.

Configuration

const admin = new PaanjAdmin(secretKey, {
  apiUrl: 'https://api.paanj.com',
  wsUrl: 'wss://ws.paanj.com',
  autoReconnect: true,
  reconnectInterval: 5000,
  maxReconnectAttempts: 10
});

Security Best Practices

  1. Never expose secret keys - Store them in environment variables or secure vaults
  2. Server-side only - This SDK includes runtime checks to prevent browser usage
  3. Rotate keys regularly - Implement key rotation policies
  4. Monitor usage - Track API key usage for suspicious activity
  5. Use HTTPS/WSS - Always use secure connections in production

Feature Packages

Build on top of @paanj/admin with feature packages:

  • @paanj/chat-admin - Chat management and monitoring
  • @paanj/voice-admin - Voice call management (coming soon)
  • @paanj/video-admin - Video call management (coming soon)
  • @paanj/storage-admin - File storage management (coming soon)

TypeScript Support

This SDK is written in TypeScript and provides complete type definitions:

import { PaanjAdmin, AdminOptions } from '@paanj/admin';

const options: AdminOptions = {
  apiUrl: 'https://api.paanj.com',
  autoReconnect: true
};

const admin = new PaanjAdmin(secretKey, options);

Error Handling

try {
  await admin.connect();
} catch (error) {
  console.error('Connection failed:', error.message);
}

Development

# Install dependencies
npm install

# Build the package
npm run build

# Watch mode for development
npm run watch

License

This project is licensed under a custom license. See the LICENSE file for details.

Support

  • 📧 Email: [email protected]
  • 📖 Documentation: https://docs.paanj.com
  • 🐛 Issues: https://github.com/paanj-cloud/admin-js/issues

Made with ❤️ by the Paanj team