Running in-browser development server [like stackblitz/codesandbox]












1















The Question:



How to run a live in-browser dev server?





Context



Stackblitz and CodeSandbox are two platforms that provide online IDE to develop web applications. I have a similar use case, and would need to run an in browser dev server, but there's not much that I was able to find, apart from these few observations.





Few Observations




  1. Stackblitz, in their announcement post describe that they use, "Progressive Web App API’s to run a live dev server in-browser."


  2. To resolve node dependencies stackblitz uses their custom npm client turbo . On the github repo page, it is described as




Express.js routes used for hydrating client-side dependencies and type definitions on StackBlitz.





  1. There is also some module bundler involved to support live development with hot-reloading.




I suspect stackblitz runs an express.js server in the service worker, but i can't seem to understand how. I'm out of ideas here, any help would be appreciated.










share|improve this question





























    1















    The Question:



    How to run a live in-browser dev server?





    Context



    Stackblitz and CodeSandbox are two platforms that provide online IDE to develop web applications. I have a similar use case, and would need to run an in browser dev server, but there's not much that I was able to find, apart from these few observations.





    Few Observations




    1. Stackblitz, in their announcement post describe that they use, "Progressive Web App API’s to run a live dev server in-browser."


    2. To resolve node dependencies stackblitz uses their custom npm client turbo . On the github repo page, it is described as




    Express.js routes used for hydrating client-side dependencies and type definitions on StackBlitz.





    1. There is also some module bundler involved to support live development with hot-reloading.




    I suspect stackblitz runs an express.js server in the service worker, but i can't seem to understand how. I'm out of ideas here, any help would be appreciated.










    share|improve this question



























      1












      1








      1








      The Question:



      How to run a live in-browser dev server?





      Context



      Stackblitz and CodeSandbox are two platforms that provide online IDE to develop web applications. I have a similar use case, and would need to run an in browser dev server, but there's not much that I was able to find, apart from these few observations.





      Few Observations




      1. Stackblitz, in their announcement post describe that they use, "Progressive Web App API’s to run a live dev server in-browser."


      2. To resolve node dependencies stackblitz uses their custom npm client turbo . On the github repo page, it is described as




      Express.js routes used for hydrating client-side dependencies and type definitions on StackBlitz.





      1. There is also some module bundler involved to support live development with hot-reloading.




      I suspect stackblitz runs an express.js server in the service worker, but i can't seem to understand how. I'm out of ideas here, any help would be appreciated.










      share|improve this question
















      The Question:



      How to run a live in-browser dev server?





      Context



      Stackblitz and CodeSandbox are two platforms that provide online IDE to develop web applications. I have a similar use case, and would need to run an in browser dev server, but there's not much that I was able to find, apart from these few observations.





      Few Observations




      1. Stackblitz, in their announcement post describe that they use, "Progressive Web App API’s to run a live dev server in-browser."


      2. To resolve node dependencies stackblitz uses their custom npm client turbo . On the github repo page, it is described as




      Express.js routes used for hydrating client-side dependencies and type definitions on StackBlitz.





      1. There is also some module bundler involved to support live development with hot-reloading.




      I suspect stackblitz runs an express.js server in the service worker, but i can't seem to understand how. I'm out of ideas here, any help would be appreciated.







      javascript express service-worker stackblitz codesandbox






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 16 '18 at 3:20







      Nishkal Kashyap

















      asked Nov 15 '18 at 14:05









      Nishkal KashyapNishkal Kashyap

      297211




      297211
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I'll be honest, I have no idea but I'd like to wildly speculate.




          • https://nodejs.org/api/vm.html


          If you're going to just be focusing on front end code, then what I would think to do is to evaluate the code in your vm with the context of whatever modules are required. React will allow you to convert the JS into html. You can update the HTML directly in the dom.



          I'm not sure how much help that is, but I will leave you with this




          • http://www.alexrothenberg.com/2012/02/29/building-a-browser-ide.html

          • https://60devs.com/executing-js-code-with-nodes-vm-module.html


          If you're interested in having a contributor, then I'm down to team up on your project!






          share|improve this answer



















          • 1





            I'll be making the project open-source, I'll update here once I do so, you're most welcome for your contributions. As for your answer, it did not help. However I've almost found the way they do it, will shortly post the answer. Or better still, a node package to do so.

            – Nishkal Kashyap
            Nov 16 '18 at 19:16











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53321235%2frunning-in-browser-development-server-like-stackblitz-codesandbox%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I'll be honest, I have no idea but I'd like to wildly speculate.




          • https://nodejs.org/api/vm.html


          If you're going to just be focusing on front end code, then what I would think to do is to evaluate the code in your vm with the context of whatever modules are required. React will allow you to convert the JS into html. You can update the HTML directly in the dom.



          I'm not sure how much help that is, but I will leave you with this




          • http://www.alexrothenberg.com/2012/02/29/building-a-browser-ide.html

          • https://60devs.com/executing-js-code-with-nodes-vm-module.html


          If you're interested in having a contributor, then I'm down to team up on your project!






          share|improve this answer



















          • 1





            I'll be making the project open-source, I'll update here once I do so, you're most welcome for your contributions. As for your answer, it did not help. However I've almost found the way they do it, will shortly post the answer. Or better still, a node package to do so.

            – Nishkal Kashyap
            Nov 16 '18 at 19:16
















          0














          I'll be honest, I have no idea but I'd like to wildly speculate.




          • https://nodejs.org/api/vm.html


          If you're going to just be focusing on front end code, then what I would think to do is to evaluate the code in your vm with the context of whatever modules are required. React will allow you to convert the JS into html. You can update the HTML directly in the dom.



          I'm not sure how much help that is, but I will leave you with this




          • http://www.alexrothenberg.com/2012/02/29/building-a-browser-ide.html

          • https://60devs.com/executing-js-code-with-nodes-vm-module.html


          If you're interested in having a contributor, then I'm down to team up on your project!






          share|improve this answer



















          • 1





            I'll be making the project open-source, I'll update here once I do so, you're most welcome for your contributions. As for your answer, it did not help. However I've almost found the way they do it, will shortly post the answer. Or better still, a node package to do so.

            – Nishkal Kashyap
            Nov 16 '18 at 19:16














          0












          0








          0







          I'll be honest, I have no idea but I'd like to wildly speculate.




          • https://nodejs.org/api/vm.html


          If you're going to just be focusing on front end code, then what I would think to do is to evaluate the code in your vm with the context of whatever modules are required. React will allow you to convert the JS into html. You can update the HTML directly in the dom.



          I'm not sure how much help that is, but I will leave you with this




          • http://www.alexrothenberg.com/2012/02/29/building-a-browser-ide.html

          • https://60devs.com/executing-js-code-with-nodes-vm-module.html


          If you're interested in having a contributor, then I'm down to team up on your project!






          share|improve this answer













          I'll be honest, I have no idea but I'd like to wildly speculate.




          • https://nodejs.org/api/vm.html


          If you're going to just be focusing on front end code, then what I would think to do is to evaluate the code in your vm with the context of whatever modules are required. React will allow you to convert the JS into html. You can update the HTML directly in the dom.



          I'm not sure how much help that is, but I will leave you with this




          • http://www.alexrothenberg.com/2012/02/29/building-a-browser-ide.html

          • https://60devs.com/executing-js-code-with-nodes-vm-module.html


          If you're interested in having a contributor, then I'm down to team up on your project!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 16 '18 at 4:02









          Sean KellySean Kelly

          598215




          598215








          • 1





            I'll be making the project open-source, I'll update here once I do so, you're most welcome for your contributions. As for your answer, it did not help. However I've almost found the way they do it, will shortly post the answer. Or better still, a node package to do so.

            – Nishkal Kashyap
            Nov 16 '18 at 19:16














          • 1





            I'll be making the project open-source, I'll update here once I do so, you're most welcome for your contributions. As for your answer, it did not help. However I've almost found the way they do it, will shortly post the answer. Or better still, a node package to do so.

            – Nishkal Kashyap
            Nov 16 '18 at 19:16








          1




          1





          I'll be making the project open-source, I'll update here once I do so, you're most welcome for your contributions. As for your answer, it did not help. However I've almost found the way they do it, will shortly post the answer. Or better still, a node package to do so.

          – Nishkal Kashyap
          Nov 16 '18 at 19:16





          I'll be making the project open-source, I'll update here once I do so, you're most welcome for your contributions. As for your answer, it did not help. However I've almost found the way they do it, will shortly post the answer. Or better still, a node package to do so.

          – Nishkal Kashyap
          Nov 16 '18 at 19:16




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53321235%2frunning-in-browser-development-server-like-stackblitz-codesandbox%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine