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

staticguard

v1.0.3

Published

Client-side password protection for static websites with customizable UI

Readme

StaticGuard

Client-side password protection for static websites with a beautiful, customizable UI.

Features

  • ✅ Zero dependencies (vanilla JavaScript)
  • ✅ Client-side SHA-256 password hashing
  • ✅ Session-based authentication
  • ✅ Rate limiting (5 attempts, 5-minute lockout)
  • ✅ Fully customizable themes via CSS variables
  • ✅ Automatic FOUC prevention
  • ✅ Mobile-first responsive design
  • ✅ Accessibility compliant (ARIA, keyboard navigation)

Installation

npm install staticguard

Quick Start

1. Generate Password Hash

npx staticguard-hash mypassword mysalt
# Output: abc123def456...

2. Copy CSS to Public Directory

Copy the StaticGuard CSS to your public/static directory:

cp node_modules/staticguard/dist/staticguard.css public/

3. Create Config File

Create a config file (e.g., staticguard-config.js):

import StaticGuard from 'staticguard';

StaticGuard.init({
  passwordHash: 'abc123def456...',
  salt: 'mysalt',
  headerText: 'Protected Content',
  subheaderText: 'Please enter the password.',
  guardImage: '/guard-image.png', // Optional
  theme: {
    primaryColor: '#8b4513',
    backgroundColor: '#faf8f6',
    pageBackgroundColor: '#3e2723',
    imageBackgroundColor: '#000000',
    borderColor: '#d4af37',
    textColor: '#342e29',
    errorColor: '#991b1b'
  }
});

4. Add to Your HTML

Add the CSS and config script to your HTML:

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="/staticguard.css" />
  <script type="module" src="./staticguard-config.js"></script>
</head>
<body>
  <!-- Your protected content -->
</body>
</html>

Note: The CSS file includes automatic FOUC prevention. No additional inline styles needed!

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | passwordHash | string | required | SHA-256 hash of password + salt | | salt | string | 'staticguard-default' | Salt for password hashing | | headerText | string | 'Protected Content' | Main heading text | | subheaderText | string | 'Please enter the password to continue.' | Subheading text | | guardImage | string | null | Optional image URL for left side | | theme | object | See below | Theme customization | | maxAttempts | number | 5 | Max failed attempts before lockout | | lockoutDuration | number | 300000 | Lockout duration in ms (5 minutes) | | sessionKey | string | 'staticguard_authenticated' | sessionStorage key |

Theme Options

All theme properties are optional:

theme: {
  primaryColor: '#8b4513',           // Border accents, button background
  backgroundColor: '#faf8f6',        // Form section background
  pageBackgroundColor: '#3e2723',    // Page overlay background
  imageBackgroundColor: '#000000',   // Image section background
  borderColor: '#d4af37',            // Modal border
  textColor: '#342e29',              // Text color
  errorColor: '#991b1b',             // Error message color
  inputBorderColor: '#d4d4d4',       // Input border
  buttonHoverColor: '#704010'        // Button hover color
}

Security Considerations

Important: StaticGuard provides client-side only password protection. This is:

Good for:

  • Preventing casual browsing
  • Keeping content out of search engines
  • Simple "password gate" for static sites

Not suitable for:

  • Protecting sensitive data
  • Enterprise security requirements
  • Defense against determined attackers

The password hash is accessible to anyone who views the page source. Use this as a lightweight access control mechanism, not true security.

License

MIT