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

prerender-edge

v1.2.8

Published

CLI to set up a zero-dependency prerender + sitemaps + script injection stack on Cloudflare (D1 + Workers) or Supabase (Postgres + Edge Functions)

Readme

prerender-edge

CLI to set up a full prerender + sitemaps + script injection stack for React SPAs on:

  • Cloudflare — D1 (SQLite) + Workers + Cron Triggers
  • Supabase — Postgres + Edge Functions + pg_cron

Pick whichever backend you want. Switch backends any time. Both are supported with the same CLI.


Install

npm install -g prerender-edge

Or use without installing:

npx prerender-edge init

Quick start

1. Login

prerender login

Asks which backend → opens the right dashboard → you paste a token.

Cloudflare — create an API token with: D1 Edit, Workers Edit, Pages Edit, Account Read
Supabase — create a Personal Access Token at app.supabase.com/account/tokens

2. Setup (one command does everything)

prerender init

Cloudflare flow:

  1. Picks your account
  2. Creates D1 database
  3. Applies schema (3 tables)
  4. Scaffolds worker source → ./prerender-worker/
  5. Copies middleware → functions/_middleware.ts
  6. Sets WORKER_URL + WORKER_SECRET on your Pages project
  7. Deploys the worker

Supabase flow:

  1. Lists your projects → you pick one
  2. Applies Postgres schema via Management API
  3. Sets function secrets (SUPABASE_URL, SERVICE_ROLE_KEY, etc.)
  4. Scaffolds edge functions → supabase/functions/
  5. Copies middleware → functions/_middleware.ts
  6. Deploys functions via supabase CLI (if installed)

3. Copy middleware to your Pages project

# After init runs, just deploy your Pages project normally.
# The _middleware.ts is already in functions/ — Cloudflare Pages picks it up automatically.

All commands

prerender login                    Authenticate (Cloudflare or Supabase)
prerender login --supabase         Log in to Supabase specifically
prerender login --cloudflare       Log in to Cloudflare specifically
prerender login --oauth <id>       Cloudflare OAuth PKCE browser flow
prerender login --token <tok>      Use a token directly (non-interactive)

prerender logout                   Log out (choose which backend)
prerender logout --all             Clear all config

prerender whoami                   Show auth status + active projects (both backends)

prerender init                     Setup wizard — asks which backend
prerender init --cloudflare        Force Cloudflare setup
prerender init --supabase          Force Supabase setup
prerender init --force             Re-run over existing config

prerender deploy                   Deploy Cloudflare Worker (needs wrangler)
prerender migrate                  Apply DB schema (D1 or Postgres)
prerender migrate --supabase       Target Supabase Postgres
prerender migrate --cloudflare     Target Cloudflare D1
prerender migrate --reset          DROP all tables then recreate (⚠ destroys data)

prerender status                   Cloudflare worker health + cache stats
prerender cache refresh            Trigger prerender cache generation now
prerender cache refresh --force    Force-regenerate all pages
prerender cache clear              Interactive cache clear
prerender cache clear --path /foo  Clear one specific path
prerender cache clear --all        Clear everything (with confirmation)
prerender cache stats              Cache statistics + cron run history
prerender logs                     Stream live Cloudflare Worker logs
prerender logs --worker <name>     Tail a specific worker

What gets deployed

Cloudflare

| Resource | What it does | |---|---| | D1 Database | Stores cached HTML, sitemaps, cron run history | | Worker | All backend routes (/api/prerender, /api/sitemap, etc.) | | Cron Trigger | Runs cache generation on a schedule (default: hourly) | | Pages Middleware | Bot detection + prerender serving + script injection |

Supabase

| Resource | What it does | |---|---| | Postgres Tables | prerendered_pages, static_sitemaps, cron_job_runs | | prerender function | Serves cached HTML | | generate-prerender-cache function | Builds cache on demand or via pg_cron | | generate-sitemap function | Dynamic sitemap XML | | serve-sitemap function | Serves stored sitemaps | | script-service function | Returns script injection tags | | manage-cron-job function | Manages pg_cron schedules |


Customize

Cache generation (Cloudflare)

After init, edit prerender-worker/src/routes/cron.tsbuildPageList():

async function buildPageList(db: D1Database): Promise<PageData[]> {
  const pages: PageData[] = [];

  // Fetch your pages from D1
  const rows = await db
    .prepare("SELECT title, slug FROM your_table WHERE active = 1")
    .all<{ title: string; slug: string }>();

  for (const row of rows.results) {
    pages.push({
      path: `/page/${row.slug}`,
      html: generateHtmlPage({ title: row.title, ... }),
    });
  }
  return pages;
}

Then redeploy: prerender deploy

Script injection

Edit prerender-worker/src/routes/scripts.ts to add analytics, tracking pixels, etc.:

const SCRIPTS = {
  head: [
    `<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXX"></script>`,
  ],
  body: [],
};

Requirements

  • Node.js >= 20
  • For Cloudflare deploy: npm install -g wrangler
  • For Supabase function deploy: npm install -g supabase

Links