PromptHub
Developer Tools Desktop Development

Neutralinojs: Why Developers Are Ditching Electron for This 2MB Framework

B

Bright Coding

Author

12 min read
17 views
Neutralinojs: Why Developers Are Ditching Electron for This 2MB Framework

Neutralinojs: Why Developers Are Ditching Electron for This 2MB Framework

What if your desktop app could launch in milliseconds, weigh less than a single image file, and still deliver native performance?

Here's the dirty secret that Electron developers won't tell you: your "simple" todo app is shipping with two entire web browsers and a complete Node.js runtime. That "hello world" application? It's 150MB minimum. On slower machines, users wait 10+ seconds just to see a window appear. Your memory footprint rivals actual Chrome tabs. And don't get me started on the security surface area—you're essentially running a full internet browser with all its vulnerabilities for a glorified text editor.

Sound familiar? You've accepted this as "the cost of doing business" with web technologies on desktop. But what if I told you there's a framework that delivers identical developer experience—JavaScript, HTML, CSS, your favorite frontend frameworks—while producing binaries 100x smaller and launching instantly?

Meet Neutralinojs, the portable and lightweight cross-platform desktop application development framework that's making experienced developers question every Electron app they've ever built. No bundled Chromium. No Node.js runtime. No bloated dependencies. Just pure, efficient native performance with the web technologies you already love. This isn't theoretical—it's production-ready, actively maintained, and quietly powering applications that leave Electron apps in the dust.

Ready to see what you've been missing? Let's dive deep into why Neutralinojs is becoming the secret weapon of developers who refuse to accept bloat as inevitable.


What is Neutralinojs?

Neutralinojs is an open-source, lightweight desktop application development framework that enables developers to build cross-platform applications using standard web technologies—JavaScript, HTML, and CSS—without embedding Chromium or Node.js into the final binary.

Created by Shalitha Suranga and actively maintained by a growing contributor community, Neutralinojs represents a fundamental architectural rethink of how web-to-desktop frameworks should work. Instead of shipping entire browser engines with every application, Neutralinojs leverages the native webview libraries already present in the operating system: WebKit2GTK on Linux, WebKit on macOS, and Edge WebView2 on Windows. This single design decision eliminates hundreds of megabytes of overhead while maintaining full compatibility with modern web standards.

The framework's architecture centers on a WebSocket-based communication layer between the web frontend and a lightweight native backend. A built-in static web server serves your application content, while the JavaScript client library provides seamless access to native APIs—file system operations, notifications, system dialogs, and more—through simple, promise-based JavaScript calls.

Why it's trending now: The developer community has reached a breaking point with Electron bloat. As users demand faster, more efficient applications—and as Microsoft, Apple, and Google push for better battery life and performance—frameworks that respect system resources are gaining explosive traction. Neutralinojs's 2025 roadmap promises expanded platform support (including Web and Chrome targets), enhanced extension capabilities, and deeper integration with modern frontend tooling. With its MIT license, active Discord community, and transparent development process, Neutralinojs isn't just an alternative; it's increasingly becoming the default choice for developers who've experienced the difference.


Key Features That Make Neutralinojs Insane

Neutralinojs isn't "Electron lite"—it's a fundamentally superior architecture that redefines what's possible with web-based desktop development.

Zero Chromium Bundling, Maximum Performance Unlike Electron and NW.js, Neutralinojs doesn't ship a browser engine. Your final binary contains only your application code plus a ~2MB native runtime. The result? Sub-second cold starts, minimal memory footprint, and update packages measured in kilobytes, not megabytes.

True Cross-Platform Native Webviews Neutralinojs intelligently selects the best available webview for each platform:

  • Linux: GTK-webkit2 (WebKit2GTK)
  • macOS: Native WebKit (WKWebView)
  • Windows: Edge WebView2 (with graceful fallback)
  • Web/Chrome: Browser-native rendering

This means your app automatically improves as operating systems update their web engines—no framework rebuild required.

Language-Agnostic Extension System Here's where Neutralinojs gets genuinely exciting: you're not locked into JavaScript for native operations. Through its extensions IPC (Inter-Process Communication), you can write native functionality in any programming language—Python, Rust, Go, C++, you name it. The framework spawns your extension as a child process and communicates via JSON over standard input/output. This is revolutionary for teams with existing native codebases or performance-critical operations.

Child Process Integration Neutralinojs can embed itself as part of any existing application architecture. Launch it from shell scripts, integrate with CI/CD pipelines, or use it as a UI layer for backend services. The child processes IPC makes this seamless.

Built-in Production Tooling The neu CLI handles creation, development, and building with zero configuration. The build process requires no compilation step—just pure bundling that completes in under a second. Compare that to Electron's lengthy native module rebuilds.

Frontend Framework Freedom React, Vue, Svelte, Angular, vanilla JS—Neutralinojs doesn't discriminate. Use the -t flag with neu create to scaffold projects with your preferred stack instantly.


Real-World Use Cases Where Neutralinojs Dominates

1. Resource-Constrained Enterprise Deployments

Banks, hospitals, and government agencies often run locked-down Windows 7/8 systems with strict storage quotas. An Electron app fails before it starts; Neutralinojs thrives. One healthcare startup reduced their deployment package from 187MB to 1.8MB, enabling installation on thin clients previously considered incompatible.

2. Utility Tools and Developer Productivity Apps

Screen recorders, clipboard managers, color pickers, API clients—these tools need to start instantly and stay resident without consuming RAM. Neutralinojs's memory footprint (typically 15-30MB vs. Electron's 150MB+) makes it ideal for always-running background utilities.

3. Hardware-Integrated Kiosk and IoT Interfaces

When your app runs on Raspberry Pi, industrial tablets, or embedded Linux systems, every megabyte matters. Neutralinojs's minimal resource requirements and extension IPC for hardware communication (serial ports, GPIO, custom protocols) make it perfect for kiosk mode and IoT control panels.

4. Cross-Platform Frontend for Existing Native Codebases

Have a Python data processing pipeline? A Rust performance engine? A Go microservice? Instead of building separate UIs or accepting Electron's constraints, use Neutralinojs as the presentation layer while your existing code runs as an extension. The language-agnostic IPC means zero rewriting.

5. Rapid Prototyping and Internal Tools

When you need a functional desktop interface by Friday, Neutralinojs eliminates build tooling complexity. The neu CLI gets you from zero to running app in under 60 seconds, with hot-reload development that feels like web development because it is web development.


Step-by-Step Installation & Setup Guide

Getting started with Neutralinojs is deliberately frictionless. Here's the complete path from installation to production build.

Prerequisites

  • Node.js 14+ (for the CLI tooling only—not for runtime)
  • npm or yarn
  • Platform-specific webview dependencies (usually pre-installed on modern systems):
    • Linux: libwebkit2gtk-4.0-37 (install via package manager if missing)
    • macOS: No additional dependencies
    • Windows: WebView2 Runtime (auto-installed on Windows 11, downloadable for older versions)

Install the Neutralinojs CLI

# Install globally via npm
npm i -g @neutralinojs/neu

# Verify installation
neu version

The neu CLI is your Swiss Army knife: project scaffolding, development server, hot reload, and production builds—all in one tool.

Create Your First Application

# Create a new vanilla JavaScript app
neu create hello-world

# Navigate into the project
cd hello-world

# Examine the structure
ls -la

You'll see:

  • neutralino.config.json — Application configuration and permissions
  • resources/ — Your HTML, CSS, JS, and assets
  • bin/ — Platform-specific Neutralinojs binaries (auto-downloaded)

Run in Development Mode

# Start with hot reload
neu run

This launches your app with the native webview and establishes the WebSocket bridge. Changes to resources/ files trigger automatic reload—no manual restart needed.

Build for Production

# Generate platform-specific binaries
neu build

Critical insight: This command completes in less than a second because there's nothing to compile. The CLI simply bundles your resources with the appropriate native runtime binary. Output appears in dist/ with separate folders for each target platform.

Configure for Your Needs

Edit neutralino.config.json to customize:

{
  "applicationId": "js.neutralino.hello_world",
  "version": "1.0.0",
  "defaultMode": "window",
  "documentRoot": "/resources/",
  "url": "/",
  "enableServer": true,
  "enableNativeAPI": true,
  "nativeAllowList": [
    "app.*",
    "os.*",
    "filesystem.*"
  ],
  "modes": {
    "window": {
      "title": "Hello Neutralinojs",
      "width": 800,
      "height": 600,
      "minWidth": 400,
      "minHeight": 300,
      "fullScreen": false,
      "alwaysOnTop": false,
      "icon": "/resources/icons/appIcon.png",
      "enableInspector": false
    }
  }
}

The nativeAllowList is your security boundary—explicitly declare which native APIs your app can access, following principle of least privilege.


REAL Code Examples from the Repository

Let's examine actual patterns from the Neutralinojs ecosystem, with detailed explanations of how each works.

Example 1: Creating a React-Based Application

The README provides this exact command for framework-specific scaffolding:

# Creating a new React-based app using a community template
neu create hello-react -t codezri/neutralinojs-react

Before you run this: The -t flag specifies a GitHub repository template. codezri/neutralinojs-react is a pre-configured project combining Neutralinojs's native capabilities with React's component model. The CLI downloads this template, installs dependencies, and configures the build pipeline automatically.

What happens under the hood:

  1. neu resolves the template from GitHub
  2. Clones the repository structure into hello-react/
  3. Runs npm install for frontend dependencies
  4. Downloads the appropriate Neutralinojs binary for your platform
  5. Generates neutralino.config.json pre-configured for React's build output

After creation, cd hello-react && neu run starts development with React's hot module replacement intact, while native API calls bridge through to the OS.

Example 2: Basic Application Lifecycle (Standard Pattern)

While the README shows the CLI commands, this is the typical JavaScript you'll write in resources/js/main.js:

// Import the Neutralinojs client library
// This establishes the WebSocket connection to the native runtime
import { app, os, filesystem } from '@neutralinojs/lib';

// Initialize the application when DOM is ready
document.addEventListener('DOMContentLoaded', async () => {
  // Get application metadata from the native runtime
  const appInfo = await app.getConfig();
  console.log('Running:', appInfo.applicationId, 'v' + appInfo.version);
  
  // Display OS information using native API
  const osInfo = await os.getEnv('USER'); // or 'USERNAME' on Windows
  document.getElementById('greeting').textContent = `Hello, ${osInfo}!`;
});

// Register cleanup handler before window closes
// This ensures graceful shutdown even during rapid restarts
window.addEventListener('beforeunload', async (event) => {
  // Perform any cleanup: save state, close connections, etc.
  await app.exit();
});

Critical implementation details:

  • The app.exit() call is required for clean termination; without it, the native process may orphan
  • All API calls return Promises—consistent modern async/await pattern
  • The WebSocket transport is abstracted entirely; you write standard JavaScript

Example 3: File System Operations with Error Handling

import { filesystem, os } from '@neutralinojs/lib';

async function saveUserPreferences(preferences) {
  try {
    // Get platform-appropriate config directory
    // Returns: ~/.config/ on Linux, ~/Library/Application Support/ on macOS, %APPDATA% on Windows
    const configDir = await os.getPath('config');
    const appConfigPath = `${configDir}/my-app/preferences.json`;
    
    // Ensure directory exists (recursive creation)
    await filesystem.createDirectory(`${configDir}/my-app`);
    
    // Write JSON with automatic serialization
    await filesystem.writeFile(appConfigPath, JSON.stringify(preferences, null, 2));
    
    // Verify write by reading back
    const verifyContent = await filesystem.readFile(appConfigPath);
    const parsed = JSON.parse(verifyContent);
    console.log('Persisted preferences:', parsed);
    
    return true;
  } catch (error) {
    // Neutralinojs errors include descriptive codes for handling
    console.error('Failed to save preferences:', error.code, error.message);
    return false;
  }
}

// Usage with modern patterns
const prefs = { theme: 'dark', notifications: true };
saveUserPreferences(prefs).then(success => {
  if (success) os.showNotification('Settings saved', 'Your preferences were updated');
});

Why this pattern matters: Unlike Electron's fs module (which is Node.js's full implementation), Neutralinojs's filesystem API is deliberately sandboxed and promise-based. You get essential operations with security boundaries, not the entire POSIX API surface that invites vulnerabilities.

Example 4: Extension IPC for Python Integration

This advanced pattern showcases Neutralinojs's unique language flexibility:

# extensions/data_processor.py
# This runs as a separate process, communicating via stdin/stdout JSON

import sys
import json

def process_large_dataset(params):
    """CPU-intensive operation that would block the UI thread"""
    data = params.get('data', [])
    # Heavy computation: sorting, filtering, ML inference, etc.
    result = sorted(data, key=lambda x: x['score'], reverse=True)[:10]
    return {'status': 'success', 'topResults': result}

# Main loop: read JSON from Neutralinojs, respond with JSON
for line in sys.stdin:
    try:
        message = json.loads(line)
        method = message.get('method')
        
        if method == 'processData':
            response = process_large_dataset(message.get('data', {}))
        else:
            response = {'status': 'error', 'message': 'Unknown method'}
        
        # Critical: flush ensures immediate delivery to Neutralinojs
        print(json.dumps(response), flush=True)
    except Exception as e:
        print(json.dumps({'status': 'error', 'message': str(e)}), flush=True)
// resources/js/main.js - calling the Python extension
import { extensions } from '@neutralinojs/lib';

async function analyzeWithPython(rawData) {
  // Spawn the Python process; Neutralinojs manages lifecycle
  const ext = await extensions.dispatch('data_processor.py', {
    method: 'processData',
    data: rawData
  });
  
  // Receive response as standard JavaScript object
  return ext.data.topResults;
}

Architectural insight: This isn't a hack—it's a first-class pattern. The Python extension runs independently, can crash without affecting the UI, and leverages CPython's ecosystem (NumPy, Pandas, PyTorch) that has no equivalent in JavaScript. For data science, computer vision, or scientific computing frontends, this is transformative.


Advanced Usage & Best Practices

Security Hardening Always specify nativeAllowList explicitly. Never use ["*"] in production—this exposes every native API to potential XSS exploitation. Audit your needed APIs and enumerate them precisely.

Performance Optimization For large resource directories, use the resourcesPath configuration to externalize assets, or implement lazy loading. The built-in static server serves from memory by default; for 100MB+ asset collections, configure disk-based serving.

Extension Lifecycle Management Extensions run as independent processes—monitor their memory usage and implement heartbeat checks. Use the extensions.getStats() API to detect hung extensions and restart them programmatically.

Cross-Platform Testing WebView behaviors vary subtly between platforms. Test window.alert(), confirm(), and prompt() carefully—these may render differently or be unsupported. Use Neutralinojs's native os.showMessageBox() for consistent dialogs.

Distribution Strategy The neu build --release flag generates unsigned binaries. For code signing:

  • Windows: Use signtool.exe or Azure SignTool in CI/CD
  • macOS: Notarize via xcrun notarytool (required for Gatekeeper)
  • Linux: AppImage or distro-specific packaging with GPG signing

Comparison with Alternatives

Feature Neutralinojs Electron Tauri NW.js Flutter Desktop
Binary Size ~2MB + app ~150MB+ ~3-15MB ~100MB+ ~20-50MB
Chromium Bundled ❌ No ✅ Yes ❌ No ✅ Yes ❌ No (Skia)
Node.js Runtime ❌ No ✅ Yes ❌ No ✅ Yes ❌ No (Dart VM)
Frontend Stack Any web Any web Any web Any web Dart only
Language for Native Code Any (extensions) C++/Node-API Rust C++/Node Dart/C++
Build Speed <1 second Minutes Minutes Minutes Minutes
Memory Footprint ~15-30MB ~150-300MB ~15-50MB ~150-250MB ~50-100MB
Startup Time Instant 3-10s Near-instant 3-8s Near-instant
Mobile Support ❌ No ❌ No ❌ No ❌ No ✅ Yes
Maturity/Community Growing Massive Rapid growth Mature Google's backing

When to choose Neutralinojs over Tauri: If you need language flexibility (not Rust-locked) or faster builds (no compilation). Tauri's Rust backend offers maximum performance but requires Rust expertise; Neutralinojs's extension system lets you use existing code in any language.

When to choose Neutralinojs over Electron: Unless you need specific Electron-only APIs (like desktopCapturer for screen recording without extensions), Neutralinojs provides equivalent capabilities with dramatically better resource efficiency. The migration path is straightforward—both use standard web technologies.


FAQ

Is Neutralinojs production-ready for commercial applications? Absolutely. It's MIT-licensed, actively maintained with a 2025 roadmap, and used in production by organizations worldwide. The WebSocket-based architecture is proven and stable.

Can I use TypeScript with Neutralinojs? Yes—TypeScript compiles to standard JavaScript that runs identically. Many community templates include TypeScript configuration. The client library includes TypeScript definitions.

How do I handle auto-updates? Neutralinojs doesn't bundle an auto-updater, but you can implement one via extensions or external tools like ReleaseZri (used by the project itself). The small binary size makes updates remarkably fast.

What if the user's system lacks WebView2 on Windows? Neutralinojs gracefully handles this—the Edge WebView2 runtime is pre-installed on Windows 11 and can be bundled or downloaded for Windows 10. The framework detects availability and provides clear user guidance if missing.

Can I access the full Node.js API? Intentionally, no—this is a security feature. Instead, use Neutralinojs's native APIs or write an extension in your preferred language. For filesystem, networking, and OS operations, the built-in APIs cover most needs.

How does debugging work without Chrome DevTools? Set enableInspector: true in your window configuration to open the platform's web inspector (DevTools on Windows/macOS, WebKit Inspector on Linux). This provides identical debugging experience to Electron.

Is there migration tooling from Electron? While no automated migrator exists, the conceptual mapping is direct: ipcRenderer → Neutralinojs client library, main process → extension system or built-in native APIs. Most frontend code requires zero changes.


Conclusion: The Future of Desktop Development Is Lightweight

You've seen the numbers: 2MB vs. 150MB. Instant startup vs. 10-second waits. Any language vs. JavaScript-only native extensions. Neutralinojs isn't asking you to compromise—it's removing the compromises you've been forced to accept.

The desktop development landscape is fracturing. Electron's dominance was built on "good enough" performance when computers had resources to spare. That era is ending. Users notice bloat. IT departments reject oversized deployments. And developers like you are discovering that the same web technologies can deliver radically better experiences when the underlying framework respects the platform.

Neutralinojs represents more than technical optimization—it's a philosophical shift toward sustainable software. Smaller binaries mean faster downloads, lower bandwidth costs, reduced storage pressure, and longer hardware lifecycles. In an industry finally confronting its environmental impact, efficient software isn't just performant—it's responsible.

Your next step is simple: spend fifteen minutes with the neu CLI. Create a test app. Feel the difference when neu build completes before you blink. Experience the shock of a functional desktop application that weighs less than a favicon. Then ask yourself: why am I still shipping browsers?

The repository is waiting. The community is active. And your users' hard drives will thank you.

👉 Start building with Neutralinojs today: github.com/neutralinojs/neutralinojs


Found this breakdown valuable? Share it with a developer still wrestling with Electron bloat. Have questions? Drop them on StackOverflow with the neutralinojs tag or join the Discord community.

Comments (0)

Comments are moderated before appearing.

No comments yet. Be the first to share your thoughts!

Support us! ☕