Making replit-based website

I am trying to make a website where you can host Node.js Websites (Dynamic Websites).
I want to build it on Flask but i don’t know how to start or how do i run Node.js Websites inside of Python/Flask.
Any help?

Thanks, Matan.

Just a tip: you should probably sandbox these node.js scripts, so malicious users can’t access any secrets or run malicious functions.

1 Like

You’ll probably need a dual repl with NodeJs and python and as @joecooldoo said you need to have a sandboxed run environment.
This is how I run sandboxed node code, after I base64 encode it:

const {NodeVM, VMScript} = require('vm2');
const vm = new NodeVM({
    timeout: 25000,
    console: 'inherit',
    sandbox: {},
    require: {
        external: true,
        builtin: ['fs', 'path'],
        root: './jail',
        mock: {
            fs: {
                readFileSync: () => 'Nice try!'

Note: this requires a node package named vm2


Thanks! I will try it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.