Stability level

Current stability level for Packaging & Code Protection:

Beta 1
Beta 2
- Pre b2.1.3 code protection part logic is removed from native side and may not protect your IP.
- It’s back again with the b2.3.0. Use embedding feature for source code protection.
Visit here to report an issue or request a feature enhancement.

Back To Top


JXcore introduces a unique feature for packaging and encryption of source files and other assets.

Let’s assume you have a large project consisting of many files. This feature packs them all into a single file to simplify the distribution. It also protects your server side javascript code by encrypting all source files.

Back To Top

Long story short

The full documentation is further down the page. But if you want a summary on how to create JX package and run, here it is:

> jx package helloworld.js "Hello world"
> jx helloworld.jx

Back To Top

Hiding body of functions

As you may already know, a JavaScript function (like everything in JavaScript – www.w3schools) is an object. To be more precise, it is an instance of the Function which inherits from the Object. And just because the Object has defined toString() method, you could also call it in a function, and the result will be a string containing function’s body.

In JXcore Packaging & Code Protection module we solved that problem.

Let’s discuss it with an example. We’ll create hide_test.js file with the following code:

exports.myMethod = function (id1) {
    return "this is some function. It returns " + id1;

And compile it into JX package:

> jx package hide_test.js "HideTest"

Now if we run it in the command window:

> jx -e 'console.log(require("./hide_test.jx").myMethod.toString());'

We’ll see the following output:


As we can see, the whole content of myMethod is currently visible. But we don’t want it to be visible, especially when we talk about code protection. To solve this, we implemented a mechanism to hide a function’s contents, but at the same time they are still functional.

Just add a special comment /*_jx_protected_*/ to the function:

exports.myMethod = function (id1) {
    return "this is some function. It returns " + id1;

and when you run the package again (after recompiling), the output will be different:


We can still call the method itself:

> jx -e 'console.log(require("./hide_test.jx").myMethod("an arg"));'

and it displays regular function’s result:


Back To Top

JX package

About JX package file

The JX package file is what you get as a result of compiling, packaging and encrypting of your project. It’s a binary file used only by JXcore executable. It contains all of the script files of your project, as well as assets, which can be considered as static resources.

Back To Top


Creating a JX package out of your project is very easy. You can either use a command line. Or you can use the Terminal (or Command Window on Windows).

First, go to the directory, where the project is located:

> cd Hello_world

Basically, the compilation tool needs a JXP project file. You can read more about this in another section: JXP project file.

But you can also generate it, if you want to make your life easier. To accomplish this, just type:

> jx package helloworld.js "Hello world"

More on this can be found at package.

As a result, you will receive both helloworld.jxp (the project’s description file) and helloworld.jx (the final package itself).

Now, having the helloworld.jxp file, you could modify it using a text editor (to add a version number, for example), and later recompile the JX package by:

> jx compile helloworld.jxp

Back To Top


JX packages can be executed as follows:

> jx my_project.jx

Obviously, you need to have JXcore installed first. For this, please visit Downloads page.

You can also run the package in multiple threads.

> jx mt my_project.jx
> jx mt-keep my_project.jx

For more details, please refer here.

Back To Top

JXP project file

About JXP project file

The JXP file is a JX package description. It contains information about the package. This is also the input file for the compilation of a JX file. It means, if you want to package your project into a JX package, you need to create a JXP project file first.

You can do it either manually or by using our jx package generation tool.

Back To Top


JXcore contains an internal JXP file generation tool. It recursively scans the current folder and generates a JXP package information file based on all the files in that directory.

It’s very easy to use from the command line. You can use the Terminal (or Command Window on Windows) for this.

First, go to the directory, where your project is located:


Type jx package to see the command syntax for creating JXP file:


Suppose you have a simple Hello_World project, with just two files: helloworld.js and index.html.


Now you can create the first JXP file with the following command:

> jx package helloworld.js "Hello World"


Initially, the tool generates JXP project file (helloworld.jxp). Then it creates the output package helloworld.jx by using the project file. In the end, you’ll have the following files in the folder:


Now, you can move helloworld.jx file to another folder and type the command:

> jx helloworld.jx

You are done!

Back To Top

Excluding folders

You can use the slim parameter for excluding folders in the JXP file generation tool. They will not be embedded into the JXP project file, as well as the compiled package.

Based on the previous example, if you need to exclude e.g. two folders: folder1 and folder2, you can do it as follows:

> jx package helloworld.js "Hello World" -slim folder1,folder2

Back To Top

Native binary


Instead of creating JX package, you can create a standalone native binary package. Once a node application compiled into native binary, it doesn’t require Node or JXcore installed on the target machine in order to run.

There are few ways of doing this.

First of them is to add -native switch to jx package command:

> jx package helloworld.js "Hello world" -native

Or you may edit JXP file and add “native” parameter with a value true:

    "native" : true

Lastly, you may also add -native switch to jx compile command:

> jx compile helloworld.jxp -native

Once it’s given from the command line, native binary will be created regardless of the value of native parameter from JXP file.

resulting binary file can be executed directly as shown below;

for *nix systems

> ./helloworld


> helloworld.exe

Back To Top