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

alphard-session-replay

v1.0.1

Published

Alphard Session Replay SDK - Record and replay user sessions with automatic user identification. One-script setup for session recording and user tracking.

Readme

alphard-session-replay

Official Alphard Session Replay SDK for recording and replaying user sessions with automatic user identification.

Features

  • Automatic User Identification - Detects and tracks users automatically
  • Easy Integration - One-line setup with any framework
  • Privacy First - Automatic masking of sensitive data
  • Lightweight - Minimal performance impact
  • Framework Agnostic - Works with React, Vue, Angular, vanilla JS, etc.

Installation

npm install alphard-session-replay

Quick Start

Basic Usage (with Auto-Identification)

import Alphard from 'alphard-session-replay';

Alphard.init({
  projectKey: 'YOUR_PROJECT_KEY',
  autoIdentify: true,
  getUserInfo: () => {
    // Return user info if available, or null
    const user = getCurrentUser();
    return user ? {
      id: user.id,
      name: user.name,
      email: user.email
    } : null;
  }
});

That's it! Sessions will be recorded AND users will be automatically identified.

Platform-Specific Examples

React / Next.js

import { useEffect } from 'react';
import { useUser } from '@clerk/clerk-react';
import Alphard from 'alphard-session-replay';

function App() {
  const { user } = useUser();
  
  useEffect(() => {
    Alphard.init({
      projectKey: process.env.NEXT_PUBLIC_ALPHARD_KEY!,
      autoIdentify: true,
      getUserInfo: () => user ? ({
        id: user.id,
        name: `${user.firstName} ${user.lastName}`,
        email: user.primaryEmailAddress?.emailAddress
      }) : null
    });
  }, [user]);

  return <YourApp />;
}

Vue.js

import { createApp } from 'vue';
import Alphard from 'alphard-session-replay';
import { useAuthStore } from './stores/auth';

const authStore = useAuthStore();

Alphard.init({
  projectKey: 'YOUR_PROJECT_KEY',
  autoIdentify: true,
  getUserInfo: () => {
    const user = authStore.currentUser;
    return user ? {
      id: user.id,
      name: user.name,
      email: user.email
    } : null;
  }
});

createApp(App).mount('#app');

Vanilla JavaScript

<script src="https://unpkg.com/alphard-session-replay"></script>
<script>
  Alphard.init({
    projectKey: 'YOUR_PROJECT_KEY',
    autoIdentify: true,
    getUserInfo: () => {
      if (window.currentUser) {
        return {
          id: window.currentUser.id,
          name: window.currentUser.name,
          email: window.currentUser.email
        };
      }
      return null;
    }
  });
</script>

Configuration Options

Alphard.init({
  // Required
  projectKey: string;
  
  // Auto-Identification
  autoIdentify?: boolean;              // Default: false
  getUserInfo?: () => UserInfo | null;
  
  // Privacy
  maskAllInputs?: boolean;             // Default: false
  maskSelectors?: string[];            // Default: []
  blockSelectors?: string[];           // Default: []
  
  // Sampling
  sampleRate?: number;                 // Default: 1.0 (100%)
  
  // Performance
  capturePageSnapshots?: boolean;      // Default: true
  snapshotOnRouteChange?: boolean;     // Default: true
  maxMousemoveFps?: number;            // Default: 10
  
  // Features
  captureConsole?: boolean;            // Default: false
  captureNetwork?: boolean;            // Default: false
  
  // Advanced
  apiUrl?: string;                     // Default: 'http://localhost:5001/api'
  consent?: boolean;                   // Default: true
  shouldRecord?: (userInfo) => boolean;
  
  // Callbacks
  onSessionStart?: (sessionId: string) => void;
  onSessionEnd?: (sessionId: string) => void;
});

API Reference

init(config: AlphardConfig)

Initialize Alphard Session Replay.

const replay = Alphard.init({
  projectKey: 'YOUR_PROJECT_KEY',
  autoIdentify: true,
  getUserInfo: () => getCurrentUser()
});

updateUser(userInfo: UserInfo | null)

Manually update user information (rarely needed with autoIdentify).

Alphard.updateUser({
  id: 'user_123',
  name: 'John Doe',
  email: '[email protected]'
});

getSessionId()

Get the current session ID.

const sessionId = Alphard.getSessionId();

stop()

Stop recording the current session.

Alphard.stop();

identify(userId: string, userData: object) (Legacy)

Legacy method for user identification. Use autoIdentify instead.

Alphard.identify('user_123', {
  name: 'John Doe',
  email: '[email protected]'
});

Privacy & Compliance

Automatic Privacy Protection

  • ✅ Password fields automatically masked
  • ✅ Credit card inputs hidden
  • ✅ Sensitive form fields obscured

Additional Privacy Controls

Alphard.init({
  projectKey: 'YOUR_PROJECT_KEY',
  
  // Mask all text inputs
  maskAllInputs: true,
  
  // Mask specific elements
  maskSelectors: ['.sensitive', '.ssn', '[data-private]'],
  
  // Block entire sections
  blockSelectors: ['.payment-details', '.confidential']
});

GDPR Compliance

// Only initialize after user consent
if (userHasGivenConsent()) {
  Alphard.init({
    projectKey: 'YOUR_PROJECT_KEY',
    consent: true
  });
}

TypeScript Support

Full TypeScript definitions included:

import Alphard, { AlphardConfig, UserInfo } from 'alphard-session-replay';

const config: AlphardConfig = {
  projectKey: 'YOUR_PROJECT_KEY',
  autoIdentify: true,
  getUserInfo: (): UserInfo | null => {
    // Your user detection logic
  }
};

Alphard.init(config);

Troubleshooting

Sessions not appearing

  1. Check Project Key is correct
  2. Verify getUserInfo() returns user object (or null)
  3. Check browser console for errors
  4. Ensure consent: true is set

User names not showing

  1. Ensure autoIdentify: true is enabled
  2. Verify getUserInfo() returns correct user object
  3. Add debug log: console.log('User:', getUserInfo())

Performance issues

  1. Reduce sample rate: sampleRate: 0.5
  2. Lower mouse tracking: maxMousemoveFps: 5
  3. Disable console/network capture

License

MIT

Support

  • Documentation: https://docs.alphard.com
  • Email: [email protected]
  • Issues: https://github.com/alphard/session-replay-sdk/issues