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

@atmoner/nuxt-electron

v0.0.11

Published

Nuxt 4 module for Electron integration with Electron Forge

Downloads

1,110

Readme

@atmoner/nuxt-electron

npm version npm downloads License

Nuxt 4 module for seamless Electron integration with Electron Forge.

nuxt-electron

Features

  • Zero Config - Works out of the box with sensible defaults
  • 🚀 Auto Start - Automatically launches Electron in development mode
  • 🔄 Hot Reload - Full HMR support for your Nuxt app
  • 📦 Easy Packaging - Built-in Electron Forge integration
  • 🎯 Type Safe - Full TypeScript support
  • Nuxt 4 Ready - Built for the latest Nuxt

Quick Setup

Method 1: Automatic Setup (Recommended)

The easiest way to get started is using the init command:

# Using npx (no installation required)
npx @atmoner/nuxt-electron init

# Or if you have the package installed
npm exec nuxt-electron-init

This will automatically:

  • ✅ Check if Nuxt is installed
  • ✅ Install Nuxt automatically if not present (runs npm create nuxt@latest new-nuxt-electron)
  • ✅ Create main.js (Electron main process)
  • ✅ Create forge.config.cjs (Electron Forge configuration)
  • ✅ Create scripts/dev-electron.js (Development script)
  • ✅ Update your package.json with required scripts and dependencies
  • ✅ Add the module to your nuxt.config.ts
  • ✅ Install all required dependencies

Then just run:

npm run electron:dev

That's it! Your Nuxt + Electron app is ready ✨

Note: If Nuxt was not installed, the init command will create it in a new-nuxt-electron directory. You'll need to run cd new-nuxt-electron before running the dev command.

Method 2: Manual Setup

  1. Add @atmoner/nuxt-electron dependency to your project
# Using npm
npm install --save-dev @atmoner/nuxt-electron

# Using yarn
yarn add --dev @atmoner/nuxt-electron

# Using pnpm
pnpm add -D @atmoner/nuxt-electron
  1. Add @atmoner/nuxt-electron to the modules section of nuxt.config.ts
export default defineNuxtConfig({
  modules: ["@atmoner/nuxt-electron"],

  electron: {
    // Module options
  },
})
  1. Install Electron dependencies
npm install --save-dev electron @electron-forge/cli @electron-forge/maker-squirrel @electron-forge/maker-zip @electron-forge/maker-deb @electron-forge/maker-rpm @electron-forge/plugin-fuses @electron/fuses
  1. Create required files (or copy from templates/ directory):
    • main.js - Electron main process
    • forge.config.cjs - Electron Forge configuration
    • scripts/dev-electron.js - Development script

Usage

Development

# If you used the automatic setup
npm run electron:dev

# Or manually
npm run dev

This will start both the Nuxt dev server and Electron automatically.

Building

# Build for production
npm run electron:build

# Or step by step
npm run build
npx electron-forge make

Configuration

Module Options

export default defineNuxtConfig({
  electron: {
    // Enable/disable the module
    enabled: true,

    // Electron main file
    main: "main.js",

    // Forge config file
    forgeConfig: "forge.config.js",

    // Nuxt dev server port
    port: 3000,

    // Auto-start Electron in dev mode
    autoStart: true,

    // Delay before starting Electron (ms)
    startDelay: 5000,

    // Kill existing processes on start
    killExisting: true,
  },
})

Templates

The module provides default templates for:

  • main.js - Electron main process
  • forge.config.js - Electron Forge configuration

You can find these in the templates/ directory.

Project Structure

your-project/
├── app/
│   └── app.vue
├── public/
├── modules/
│   └── nuxt-electron/          # If developing locally
├── main.js                      # Electron main process
├── forge.config.js             # Electron Forge config
├── nuxt.config.ts
└── package.json

Package.json Scripts

After running npx @atmoner/nuxt-electron init, your package.json will include:

{
  "type": "module",
  "scripts": {
    "dev": "nuxt dev",
    "build": "nuxt build",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare",
    "electron:dev": "node scripts/dev-electron.js",
    "electron:build": "nuxt build && electron-forge make"
  }
}

How It Works

  1. Development Mode: The module hooks into Nuxt's dev server lifecycle
  2. Auto Launch: When Nuxt is ready, Electron starts automatically
  3. Clean Exit: Processes are properly cleaned up on exit
  4. Production Build: Nuxt builds to .output/, Electron Forge packages the app

Example Project

Check out the playground/ directory for a complete example.

Advanced Usage

Custom Electron Configuration

You can customize the Electron window in your main.js:

const mainWindow = new BrowserWindow({
  width: 1200,
  height: 800,
  webPreferences: {
    nodeIntegration: false,
    contextIsolation: true,
  },
})

Multiple Makers

Configure different installers in forge.config.js:

export const makers = [
  {
    name: "@electron-forge/maker-squirrel",
    platforms: ["win32"],
  },
  {
    name: "@electron-forge/maker-zip",
    platforms: ["darwin"],
  },
  {
    name: "@electron-forge/maker-deb",
    platforms: ["linux"],
  },
]

Troubleshooting

Port Already in Use

If you see "Port 24678 is already in use":

  • The module automatically kills existing processes when killExisting: true
  • Manually kill processes: pkill -f "nuxt dev"

Electron Won't Start

  • Check that main.js exists in your project root
  • Ensure Electron dependencies are installed
  • Try increasing startDelay in module options

Build Issues

  • Run nuxt build first before electron-forge make
  • Check that .output/ directory exists
  • Verify forge.config.js includes .output in extraResource

Development

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the module
npm run prepack

# Run tests
npm test

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License © 2025 atmoner