Module reference 📦

The module is mainly working on the renderer process, but needs to be initiated in the main process for crash reports on Mac.


Using npm:

$ npm install electron-nucleus --save


In both renderer and main process add the following script:
If you don't add it to the main process, it won't be able to report crashes.

const Nucleus = require("electron-nucleus")("<Your App Id>")

You can sign up and get an ID for your app here.


You can init Nucleus with options:

const Nucleus = require("electron-nucleus")("<Your App Id>", {
    disableInDev: false, // disable module while in development (default: false)
    userId: '', // Set a custom identifier for this User
    version: '1.3.9', // Set a custom version
    language: 'es' // Set a custom language

Where options is an object, where each property is optional.

Note : when running in development, the app version will be '0.0.0'


After initializing Nucleus, you can send your own custom events.


They are a couple events that are reserved by Nucleus: init, error:*

You can't report these events.

License checking

You can check if a license (created via Nucleus's API) is valid with the following code:

Nucleus.checkLicense('SOME_LICENSE', (err, license) => {
    if (err) return console.error(err)

    if (license.valid) {
        console.log('License is valid :) Using policy '+license.policy)
    } else {
        console.log('License is invalid :(')


Nucleus will by default report all uncaughtException, unhandledRejection and crashes using Electron's crash reporter.

If you'd like to act on these errors, for example show them to your user, quit the app or reload it, you can define an onError function, which will be called on errors happening on the respective process.

Nucleus.onError = (type, err) => {
    // type will either be uncaughtException, unhandledRejection or windowError

windowError is an uncaughtException that happened in the renderer process. It was catched with window.onerror.

If you'd like to report another type of error, you can do so with:

Nucleus.trackError('weirdError', err)


If the user is running a version inferior to the one set in your app settings (account section in the dashboard), it can call a function so you can alert the user (or something else).

Nucleus.onUpdate = (lastVersion) => {
    alert('New version available: ' + lastVersion)

Note : when running in development, the app version will be '0.0.0', so you can test this by setting a higher version in your dashboard