Node.js on SAFE

Are there any plans on how to run Node.js on the SAFE network? Since files can be accessed from the entire network in a deduplicated way, a huge library of Node.js modules can be made available through some common include/import/require method.

Node Red is REALLY cool… It would be great to see it on SAFE.

Yes it’s already one of the first of the ports projects languages.

5 Likes

He speaks the truth.

See it yourself here: https://github.com/maidsafe/MaidSafe-Ports/tree/master/src

I haven’t used Node.js yet but that’s what I want to use on the SAFE network. How will node modules be loaded? And how are versions handled? For example require('sqlite3.2.1') could perhaps fetch the file based on its SAFE hash value. And then only a common mapping between module-version names and SAFE hash values is needed for finding all the node modules.

Loadable modules can be loaded based on their name and version, jquery-1.10.2.js or whatever it is that one loads from the app.

And with deduplication, if I use a module in an app and that exact same file has already been stored on the SAFE network publicly by someone else, then since the file the same hash, my app doesn’t store the actual module file. Or is app data always private so that each app needs to store copies of the modules?

The two issues are separate.

Apps can access public data so if someone shares this file as public you can access it from your app, but you would be trusting them not to mess with it. Like loading from the node.js website.

If you just store the file privately and it has already been saved, de-deduplication will happen, whether that means you don’t get charged for storing it is a separate question that I’m not sure is finalised.

1 Like

Well blocks are larger than JavaScript files, so it’s unlikely that you’ll benefit from that (extremely unlikely, actually).
But at the same time those are very small sizes and they don’t even need to be loaded from your site (they can be loaded from whatever site out there, such as the Internet or any other MaidSafe site).

If the site is public, then anyone can see it, but if it’s private, you could still link those JavaScript files from elsewhere (instead of safe://yoursite.safe/js.js your site could contain safe://publicsite.safe/js.js).
It’s no different from the Web today. It’s safer to link them from your site because then you don’t depend on others.