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

@b9g/platform-cloudflare

v0.1.13

Published

Cloudflare Workers platform adapter for Shovel - already ServiceWorker-based!

Readme

@b9g/platform-cloudflare

Cloudflare Workers platform adapter for Shovel. Runs ServiceWorker applications on Cloudflare's edge network with R2 storage and static assets support.

Installation

npm install @b9g/platform-cloudflare

Module Structure

@b9g/platform-cloudflare
├── /caches      # CloudflareNativeCache (Cloudflare Cache API wrapper)
├── /directories # CloudflareR2Directory, CloudflareAssetsDirectory
├── /variables   # envStorage (per-request Cloudflare env access)
└── /runtime     # Worker bootstrap (initializeRuntime, createFetchHandler)

Configuration

Configure in shovel.json:

{
  "platform": "cloudflare",
  "caches": {
    "default": {
      "module": "@b9g/platform-cloudflare/caches"
    }
  },
  "directories": {
    "public": {
      "module": "@b9g/platform-cloudflare/directories",
      "export": "CloudflareAssetsDirectory"
    },
    "uploads": {
      "module": "@b9g/platform-cloudflare/directories",
      "binding": "uploads_r2"
    }
  }
}

Requirements

Shovel requires Node.js compatibility for AsyncLocalStorage and process.env support. Add to your wrangler.toml:

compatibility_date = "2025-04-01"
compatibility_flags = ["nodejs_compat"]

With compatibility_date of 2025-04-01 or later, process.env is automatically populated with your environment variables and secrets at module load time. For earlier dates, add nodejs_compat_populate_process_env to compatibility_flags.

Exports

Main Package (@b9g/platform-cloudflare)

  • CloudflarePlatform - Platform adapter (default export)

Caches (@b9g/platform-cloudflare/caches)

  • CloudflareNativeCache - Wrapper around Cloudflare's Cache API (default export)

Directories (@b9g/platform-cloudflare/directories)

  • CloudflareR2Directory - FileSystemDirectoryHandle for R2 buckets (default export)
  • CloudflareAssetsDirectory - FileSystemDirectoryHandle for static assets
  • R2FileSystemDirectoryHandle - Base R2 directory implementation
  • R2FileSystemFileHandle - Base R2 file implementation
  • CFAssetsDirectoryHandle - Base assets directory implementation
  • CFAssetsFileHandle - Base assets file implementation

Runtime (@b9g/platform-cloudflare/runtime)

  • initializeRuntime(config) - Initialize worker runtime
  • createFetchHandler(registration) - Create ES module fetch handler
  • CloudflareFetchEvent - Extended FetchEvent with env bindings

Variables (@b9g/platform-cloudflare/variables)

  • envStorage - AsyncContext for per-request Cloudflare env access
  • getEnv() - Get current request's env bindings

Bindings

Configure bindings in wrangler.toml. Use lowercase binding names to avoid env expression parsing issues:

compatibility_date = "2024-09-23"
compatibility_flags = ["nodejs_compat"]

# R2 bucket for uploads directory
[[r2_buckets]]
binding = "uploads_r2"
bucket_name = "my-uploads-bucket"

# Static assets (always uses ASSETS binding)
[assets]
directory = "./public"

Directory Types

| Type | Use Case | Read/Write | Binding | |------|----------|------------|---------| | R2 | User uploads, dynamic storage | Both | User-defined | | Assets | Static files deployed with worker | Read-only | Always ASSETS |

License

MIT