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

create-addon

v0.1.2

Published

Create Node.js native addons with ease

Readme

create-addon

🚀 Create Node.js native addons with ease

A modern CLI tool for scaffolding Node.js native addon projects with an interactive interface. Generate boilerplate code for C++, Objective-C, and Swift addons with platform-specific templates.

Features

  • 🎯 Interactive CLI - Beautiful terminal UI built with React and Ink
  • 🏗️ Multiple Templates - Support for C++, Objective-C, and Swift
  • 🔧 Platform-Specific - Templates optimized for Linux, Windows, and macOS
  • Modern N-API - Uses node-addon-api for modern native bindings
  • 🎨 EventEmitter Pattern - Built-in event system for native-to-JS communication
  • 📦 Ready to Build - Pre-configured with node-gyp and build scripts

Installation

npm install -g create-addon

Or use directly with npx:

npx create-addon my-project

Quick Start

Interactive Mode

Launch the interactive CLI to create a new project:

create-addon

Semi-Interactive Mode

Provide a project name and select a template interactively:

create-addon my-awesome-addon

Non-Interactive Mode

Create a project with all options specified:

create-addon my-awesome-addon --template cpp-linux

Templates

🐧 cpp-linux

C++ addon optimized for Linux platforms with GTK+ integration.

Features:

  • GTK+ GUI components
  • Event-driven architecture
  • Todo management functionality
  • Platform detection and safety checks

🪟 cpp-win32

C++ addon designed for Windows platforms.

Features:

  • Windows-specific APIs
  • Native Win32 integration
  • Event system for UI interactions
  • Build configuration for Windows

🍎 objective-c

Objective-C addon for macOS with native Cocoa integration.

Features:

  • Native macOS UI components
  • Todo management with Objective-C classes
  • Bridge between Objective-C and JavaScript
  • macOS-specific functionality

🦉 swift

Swift addon for macOS with modern Swift integration.

Features:

  • Modern Swift code
  • Native Swift-to-JavaScript bridge
  • Event-driven communication
  • macOS platform optimization

Usage Examples

Creating Different Types of Addons

# Create a C++ addon for Linux
create-addon my-cpp-addon --template cpp-linux

# Create a Swift addon for macOS
create-addon my-swift-addon --template swift

# Create an Objective-C addon
create-addon my-objc-addon --template objective-c

# Create a Windows C++ addon
create-addon my-win-addon --template cpp-win32

Skip Dependency Installation

create-addon my-project --skip-install

Command Line Options

create-addon [project-name] [options]

Options:
  -t, --template <template>  Template to use (cpp-linux, cpp-win32, objective-c, swift)
  --skip-install            Skip installing dependencies
  -h, --help               Show help

Generated Project Structure

Each generated project includes:

my-project/
├── binding.gyp          # node-gyp build configuration
├── package.json         # Project configuration and scripts
├── src/                 # Native source code
│   ├── addon.cc         # Main addon implementation
│   └── ...              # Additional source files
├── include/             # Header files
│   └── *.h              # Platform-specific headers
└── js/
    └── index.js         # JavaScript wrapper with EventEmitter

Building Your Addon

After creating your project:

cd my-project

# Install dependencies
npm install

# Build the native addon
npm run build

# Clean build artifacts
npm run clean

# Build for Electron (if needed)
npm run build-electron

Using Your Addon

Generated addons follow a consistent EventEmitter pattern:

const addon = require("./js/index.js");

// Basic usage
console.log(addon.helloWorld("Hello from Node.js!"));

// GUI interaction (platform-specific)
addon.helloGui();

// Event handling
addon.on("todoAdded", (todo) => {
  console.log("New todo:", todo);
});

addon.on("todoUpdated", (todo) => {
  console.log("Updated todo:", todo);
});

addon.on("todoDeleted", (todo) => {
  console.log("Deleted todo:", todo);
});

Development

Prerequisites

  • Node.js 16+
  • Python 3.x (for node-gyp)
  • Platform-specific build tools:
    • Linux: build-essential, GTK+ development libraries
    • Windows: Visual Studio Build Tools
    • macOS: Xcode Command Line Tools

Building the CLI

# Clone the repository
git clone https://github.com/himself65/create-addon.git
cd create-addon

# Install dependencies
pnpm install

# Build the CLI
pnpm run build

# Test locally
node dist/bin.js

Development Mode

# Build with watch mode
pnpm run dev

Contributing

We welcome contributions! Please feel free to submit a Pull Request.

Development Setup

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Build and test (pnpm run build)
  5. Commit your changes (git commit -m 'Add some amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

License

MIT © himself65

Credits to the Felix electron-native-code-demos for inspiration and initial templates.