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:
- First, the handler checks if a matching file exists in the
public/folder. - If not found, it executes
server.jsand callshandleRequest(). - If
server.jsreturns a response object, it is sent to the client. - If
server.jsreturnsnull, a 404 is returned.
No comments to display
No comments to display