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

@axiomify/static

v7.0.0

Published

Static file serving for Axiomify — 36 MIME types, ETag, SPA index fallback, realpath containment, immutable cache-control.

Readme

@axiomify/static

npm version codecov OpenSSF Scorecard License: MIT

Static file serving for Axiomify with ETag caching, configurable cache control, and path traversal protection.

Install

npm install @axiomify/static

Quick start

import { serveStatic } from '@axiomify/static';

serveStatic(app, {
  prefix: '/public',
  root: './public',
});
// Serves GET /public/* from ./public/

Options

| Option | Default | Description | | ------------------------- | ----------------------------------- | -------------------------------------------------------------------------------- | | prefix | required | URL path prefix (e.g. '/public', '/'). | | root | required | Filesystem directory to serve files from. | | cacheControl | 'public, max-age=86400' | Cache-Control header value for all files. | | forceDownloadExtensions | ['.svg', '.html', '.htm', '.xml'] | Extensions served with Content-Disposition: attachment. Prevents SVG/HTML XSS. | | serveIndex | true | Serve index.html when a directory path is requested. |

Cache control examples

// Immutable content-hashed assets (JS bundles, CSS)
serveStatic(app, {
  prefix: '/assets',
  root: './dist',
  cacheControl: 'public, max-age=31536000, immutable',
});

// API responses / no caching
serveStatic(app, { prefix: '/data', root: './data', cacheControl: 'no-store' });

// CDN with stale-while-revalidate
serveStatic(app, {
  prefix: '/media',
  root: './media',
  cacheControl: 'public, max-age=3600, stale-while-revalidate=86400',
});

Supported MIME types

| Extension | Content-Type | | ---------------------------------------- | --------------------------------------- | | .html, .htm | text/html; charset=utf-8 | | .css | text/css; charset=utf-8 | | .js, .mjs | application/javascript; charset=utf-8 | | .json | application/json; charset=utf-8 | | .png, .jpg, .gif, .webp, .avif | image/* | | .svg | image/svg+xml | | .woff, .woff2, .ttf | font/* | | .mp4, .webm, .mp3, .wav | video/*, audio/* | | .pdf | application/pdf | | .csv | text/csv; charset=utf-8 | | .yaml, .yml | application/yaml | | .wasm | application/wasm | | .ico | image/x-icon | | anything else | application/octet-stream |

Security

  • Path traversal: resolved paths must stay within root. ../ sequences return 403.
  • Null bytes: requests containing \0 return 403.
  • SVG/HTML XSS: these extensions are served with Content-Disposition: attachment by default so browsers download them instead of rendering. Override with forceDownloadExtensions: [].
  • ETag: weak ETags based on file size and mtime. If-None-Match returns 304.

Directory index

serveStatic(app, {
  prefix: '/',
  root: './dist',
  serveIndex: true, // default — serves index.html for directory requests
  cacheControl: 'no-store', // don't cache the HTML shell
});

serveIndex serves index.html when a directory path is requested (e.g. /./dist/index.html). It is not a catch-all SPA rewrite: a request for a non-existent path such as /client/route returns 404, not index.html. For client-side routing, add a fallback route of your own that returns the HTML shell for unmatched paths.