Skip to main content

Overview

ZyveraWeb can run server-side JavaScript directly inside the JVM using GraalVM Polyglot (GraalJS). No external Node.js binary is required.

How It Works

The plugin creates a JavaScript runtime for each Node.js project. JavaScript files are evaluated within this context, giving them access to the CommonJS module system (via require()) and npm packages.

JavaScript vs Node.js

Feature Support Notes
CommonJS require() Supported Resolves from node_modules/
npm packages Supported Auto-installed from registry
ES Modules (import) Not supported Use CommonJS require()
Node.js built-ins (fs, http, etc.) Partial Some core modules available via GraalJS
Browser APIs (window, document) Not available Server-side only
console.log Supported Output goes to plugin logger

Requirements

  • JDK 21+ with GraalVM support (recommended: GraalVM JDK 21)
  • Without a GraalVM-compatible JDK, Node.js features will be unavailable and the handler will return an error page

Request Flow

For each Node.js site request:

  1. First, the handler checks if a matching file exists in the public/ folder.
  2. If not found, it executes server.js and calls handleRequest().
  3. If server.js returns a response object, it is sent to the client.
  4. If server.js returns null, a 404 is returned.