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

@electroplix/adapter

v0.1.6

Published

CLI for setting up Cloudflare Workers deploy pipelines in Next.js projects via OpenNext.

Readme

⚡ @electroplix/adapter

CLI for setting up Cloudflare Workers deploy pipelines in Next.js projects via OpenNext.

Zero-config setup — run one command inside any Next.js project to get a production-ready Cloudflare Workers deployment pipeline with optional GitHub Actions CI/CD.


Quick Start

# npx (no install required)
npx @electroplix/adapter

# or with pnpm
pnpm dlx @electroplix/adapter

# or install globally
npm i -g @electroplix/adapter
electroplix-adapter

Run the command inside your Next.js project root. The CLI will walk you through setup interactively.


What It Does

When you run electroplix-adapter, the CLI will:

1. Detect Your Project

  • Validates you're inside a Next.js project
  • Auto-detects your package manager (npm, pnpm, yarn, bun)
  • Checks for existing OpenNext / Wrangler configuration

2. Install Dependencies

| Package | Type | Purpose | |---------|------|---------| | @opennextjs/cloudflare | dependency | OpenNext adapter for Cloudflare Workers | | wrangler | devDependency | Cloudflare Workers CLI |

3. Inject Scripts into package.json

The following scripts are added (existing scripts with the same name are preserved unless you choose to overwrite):

| Script | Command | Description | |--------|---------|-------------| | build | next build | Standard Next.js build | | dev | next dev | Start local dev server | | start | next start | Start production server | | preview | opennextjs-cloudflare build && opennextjs-cloudflare preview | Build & preview locally on Workers | | deploy | opennextjs-cloudflare build && opennextjs-cloudflare deploy | Build & deploy to Cloudflare Workers | | cf-typegen | wrangler types --env-interface CloudflareEnv env.d.ts | Generate Cloudflare env types |

4. Generate Configuration Files

| File | Purpose | |------|---------| | open-next.config.ts | OpenNext Cloudflare configuration (with R2 cache comments) | | wrangler.jsonc | Cloudflare Workers config (worker name, assets, compatibility flags) | | env.d.ts | TypeScript interface for Cloudflare environment bindings |

5. (Optional) GitHub Actions Deploy Pipeline

If you say yes when prompted, a .github/workflows/deploy.yml is generated that:

  • Triggers on push to main or manual dispatch
  • Installs dependencies using your detected package manager
  • Builds with OpenNext and deploys to Cloudflare Workers
  • Uses CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID secrets

Generated Files

After running the CLI, your project will have:

your-nextjs-project/
├── open-next.config.ts          ← OpenNext Cloudflare config
├── wrangler.jsonc               ← Cloudflare Workers config
├── env.d.ts                     ← CloudflareEnv type interface
├── .github/
│   └── workflows/
│       └── deploy.yml           ← CI/CD pipeline (optional)
└── package.json                 ← Updated with deploy scripts

Usage After Setup

# Local development
npm run dev

# Build & preview on Workers locally
npm run preview

# Build & deploy to Cloudflare Workers
npm run deploy

# Generate Cloudflare env types
npm run cf-typegen

GitHub Actions Setup

If you opted into the CI/CD pipeline, add these secrets to your GitHub repository:

| Secret | Description | |--------|-------------| | CLOUDFLARE_API_TOKEN | API token from Cloudflare dashboard (Workers:Edit permission) | | CLOUDFLARE_ACCOUNT_ID | Your Cloudflare account ID |

The pipeline will automatically deploy on every push to main.


Programmatic API

You can also use the adapter programmatically in your own tooling:

import {
  detectProject,
  installPackages,
  injectScripts,
  writeConfigFiles,
  writeGitHubActions,
} from '@electroplix/adapter';

const info = detectProject(process.cwd());

// Install @opennextjs/cloudflare + wrangler
installPackages(info.packageManager, info.root);

// Add deploy/preview/build scripts to package.json
injectScripts(info.root);

// Generate open-next.config.ts, wrangler.jsonc, env.d.ts
writeConfigFiles(info.root, 'my-worker-name');

// Generate .github/workflows/deploy.yml
writeGitHubActions(info.root, info.packageManager);

Exported Functions

| Function | Description | |----------|-------------| | detectProject(root) | Detect Next.js project, package manager, existing config | | detectPackageManager(root) | Detect npm / pnpm / yarn / bun | | installPackages(pm, cwd) | Install required dependencies | | injectScripts(root, overwrite?) | Merge deploy scripts into package.json | | writeConfigFiles(root, name, overwrite?) | Generate OpenNext + Wrangler config files | | writeGitHubActions(root, pm, overwrite?) | Generate GitHub Actions deploy workflow | | openNextConfigContent() | Get open-next.config.ts content as string | | wranglerConfigContent(name) | Get wrangler.jsonc content as string | | envDtsContent() | Get env.d.ts content as string | | deployWorkflowContent(pm) | Get deploy.yml content as string |


Requirements

  • Node.js 18+
  • Next.js project (any version 13+)
  • Cloudflare account (for deployment)

Links

Run nx test adapter to execute the unit tests via Jest.