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

ssr-for-bots

v1.0.1-c

Published

SSR-for-bots is an express middleware that will apply SSR to your application only when bots are visiting it

Readme

ssr-for-bots

Basic SSR middleware for Express. Use to prerender your pages for bots so they can read your meta-data if you're using a client side rendering app, or if you want to boost your website SEO score.

Note: this module uses puppeteer. It also stores all the prendered pages to an internal cache store. It's fine for boosting SEO scores, and making the bots able to read meta-data (In case of a React CRA app for example) but it might not produce the desired effect when attempting to use it to serve your pages to users. If you need a more viable solution, I recommend using a framework that uses SSR by default.

Install

$ npm install --save ssr-for-bots

Or if you're using yarn

$ yarn add ssr-for-bots

Usage

For a server where the ssr service should be applied:

const ssrForBots = require("ssr-for-bots");

const defaultOptions = {
  prerender: [], // Array containing the user-agents that will trigger the ssr service | uses Regex
  exclude: [], // Array containing paths and/or extentions that will be excluded from being prerendered by the ssr service | uses Regex
  useCache: true, // Variable that determins if we will use page caching or not
  cacheRefreshRate: 86400, // Seconds of which the cache will be kept alive, pass 0 or negative value for infinite lifespan
};

// If  you're service an API on a route called /api for example add it too the exclude :
// exclude: ["/api/"]

//  apply to all requests
app.use(ssrForBots());

// or if you want to use options
app.use(ssrForBots(defaultOptions));

Configuration options

prerender

Array containing the user-agents that will trigger the ssr service uses Regex.

Note: The array you pass will be added to the default array list.

Defaults to ["bot","googlebot","Chrome-Lighthouse","DuckDuckBot","ia_archiver","bingbot","yandex","baiduspider","Facebot","facebookexternalhit","facebookexternalhit/1.1","twitterbot","rogerbot","linkedinbot","embedly","quora link preview","showyoubot","outbrain","pinterest","slackbot","vkShare","W3C_Validator"].

exclude

Array containing the paths that will be excluded from the ssr service uses Regex.

Note: The array you pass will be added to the default array list.

Defaults to [".xml", ".ico", ".txt", ".json"].

Example if you're serving an API on /api path add : ["/api/"] it will exclude all paths that contains "/api/"

useCache

Determins if you want to use cache or not.

The service uses a map to cache all prerendered urls and will return them immediatly if they're cached.

Defaults to true

cacheRefreshRate

Cache refresh rate will determine the cache life span expressed in seconds.

If a page has been cached for more than the cache refresh rate, it will be removed from cache, rerendered and put back to cache right after.

Defaults to 86400 : 24 hours

License

MIT © Montassar Laribi