2

WE had developed a project in nodejs. Client will distribute/sell the application with their clients, hence I must needed to hide them(compile) rather than delivering source code. please provide me proper steps from beginning to compile them, and use them.

Chaitanya Joshi
  • 284
  • 1
  • 4
  • 21

3 Answers3

1

Did you see this answer: Can I make Node.JS app self executable?

Let me requote it:

  1. Download and Install JXcore
  2. Go to your apps folder
  3. Run jx package index.js myapp -native
Community
  • 1
  • 1
infografnet
  • 3,039
  • 1
  • 25
  • 30
-1

You can use node-webkit it will build executable for Windows, Linux and Mac OS.

KlwntSingh
  • 998
  • 7
  • 25
  • thank you 4 responding. NW.js is about making executable file. its a huge change, I just wanted to hide the source code. – Chaitanya Joshi May 27 '15 at 08:50
  • okay.[this](http://stackoverflow.com/questions/5951302/node-js-code-protection) might help – KlwntSingh May 27 '15 at 10:16
  • 1
    As the highest upvoted comment on that answer says, it's not in the remotest bit secure. There's a few more solutions here: https://stackoverflow.com/questions/9413123/secure-distribution-of-nodejs-applications – chedabob May 28 '15 at 07:51
  • 1
    Personally though, I'd just distribute the plain JS source code and make sure that whoever gets the source has signed a solid license agreement preventing them from doing anything untoward with it. Hiding the source in a compiled binary won't stop someone determined to find out your secrets – chedabob May 28 '15 at 07:53
-1

I've had good experiences in using uglify.js to.. well uglify everything, then i pass through a hand written function that changes identifier calls to their hex version with a header (eg hello becomes a-48656c6c6f), then run what's left through either PKG (available on npm) or tar it up and write a loader in pgk that loads the tar into it's snapshot at compile, and boom your program logic is only ever loaded into memory at runtime. Still not foolproof, but at least at this point if they got through then they could have just wrote it themselves. Sorry for the revive btw, hope this helps someone as 4 years later this is still a grey area

Edit You could also (if your comfortable with JavaScript, V8 api, and c++) write a native module and bundle the native module with some loader module. Sorry trying to be informative and consise (typing on mobile is a pain)

Werlious
  • 376
  • 5
  • 12