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

session-spa

v3.3.1

Published

Single Sign-On service for DoneIsBetter platform

Downloads

5

Readme

Session SPA

DoneIsBetter SSO Service

A secure, easy-to-integrate Single Sign-On (SSO) service for web applications.

Features

  • 🔐 Secure authentication and session management
  • 🌐 Cross-origin support for multiple applications
  • 👥 User permission management
  • ⚡️ Real-time session validation
  • 🔄 Automatic session monitoring
  • 📱 Responsive login interface

Quick Start

1. Install the Client Library

npm install @doneisbetter/sso-client
# or
yarn add @doneisbetter/sso-client

2. Initialize the SSO Client

import { SSOClient } from '@doneisbetter/sso-client';

const sso = new SSOClient('https://your-sso-server.com');

3. Implement Authentication

// Check authentication status
async function checkAuth() {
  const session = await sso.validateSession();
  
  if (session.isValid) {
    // User is authenticated
    const { username, permissions } = session.user;
    console.log(`Authenticated as: ${username}`);
    console.log('Permissions:', permissions);
  } else {
    // Redirect to login
    sso.redirectToLogin();
  }
}

// Handle logout
async function handleLogout() {
  try {
    await sso.signOut();
    window.location.href = '/login';
  } catch (error) {
    console.error('Logout failed:', error);
  }
}

4. Enable Session Monitoring

// Monitor session status
const cleanup = sso.enableSessionMonitoring({
  interval: 60000, // Check every minute
  onInvalidSession: () => {
    alert('Session expired. Please log in again.');
    sso.redirectToLogin();
  },
  onError: (error) => {
    console.error('Session check failed:', error);
  }
});

// Clean up when component unmounts
cleanup();

Documentation

Configuration

Client Options

const sso = new SSOClient('https://your-sso-server.com', {
  loginPath: '/auth/login',            // Custom login path
  logoutPath: '/api/auth/logout',      // Custom logout endpoint
  validatePath: '/api/auth/validate',  // Custom validation endpoint
  headers: {                          // Additional headers
    'X-Custom-Header': 'value'
  }
});

Environment Variables

Configure your SSO server with these environment variables:

SSO_SERVER_URL=https://your-sso-server.com
SESSION_SECRET=your-session-secret
MONGODB_URI=your-mongodb-uri
ALLOWED_ORIGINS=https://app1.com,https://app2.com

Security Features

  • HTTP-only session cookies
  • CSRF protection
  • Rate limiting
  • Secure password hashing
  • Session expiration
  • Permission-based access control

Error Handling

The SSO client provides detailed error information:

try {
  const session = await sso.validateSession();
  // Handle successful validation
} catch (error) {
  if (error.code === 'SESSION_EXPIRED') {
    // Handle expired session
  } else if (error.code === 'NETWORK_ERROR') {
    // Handle network issues
  }
}

Best Practices

  1. Always validate sessions on sensitive operations
  2. Implement proper error handling
  3. Use HTTPS in production
  4. Regularly monitor session status
  5. Follow security recommendations

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Support

License

MIT License - see LICENSE for details A Single Page Application for managing user sessions and permissions.

Version

Version Badge

Dependencies

  • Next.js ^15.4.2
  • React ^19.1.0
  • MongoDB ^6.3.0
  • Node.js >= 14.0.0
  • TypeScript >= 4.5.0

Quick Start

  1. Install dependencies:

    npm install
  2. Run the development server:

    npm run dev
  3. Open http://localhost:3000 in your browser.

Features

  • Username-based authentication
  • Admin user management
    • Rename users
    • Toggle admin rights
    • Delete users
  • Activity logging
  • Permission system

Documentation