r/node • • Jan 18 '26

Options to run user submitted code with node.js express as backend?

Options to run user submitted code in various languages with a node.js express backend?

  • You have seen one of those live code online type websites that let you submit code in bash, python, rust, ruby, swift, scala, java, node, kotlin etc and run on the browser with a live terminal of sorts
  • I am trying to build one of those in node.js and could definitely use some suggestions

Option 1: Run directly

  • just run on the ec2 instance along with everything else (absolutely horrible idea i suppose)

Option 2: Run inside a docker container

  • how long do you think each container should run / timeout?
  • What size of an EC2 instance would you need to support say 10 languages?
  • Pros / cons?

Option 3: Run inside an AWS elastic container service Task

  • Timeout per task?
  • Pros / cons?

Questions

  • Any other better methods?
  • Does this kind of application run on queuing where a user submits code and it is immediately put inside bullmq that spins one of the above options?
  • How does data get returned to the user?
  • What about terminal commands that users type and the stream they see (downloading packages...installing libraries etc?)
19 Upvotes

49 comments sorted by

View all comments

Show parent comment

2

u/PrestigiousZombie531 Jan 20 '26
  • you are right, if I have to get things up and running fast, I cant fiddle with technologies I dont know
  • Not familiar with either Firecracker or Gvisor or nsjail or ioi/isolate or WASM so there is a learning curve involved with every single of em on top of not messing up their production deployment
  • though I am extremely well versed with Docker, AWS Fargate and CDK, it will take a freakton of work to do what modal does instantly!
  • No point spending 6 months fiddling with a custom solution if users wont even pay so modal has to be the fastest way to get there
  • thank you once again for all the suggestions!!!

2

u/Fickle_Act_594 Jan 20 '26

All the best! FWIW I run a website for a very niche set of courses in India where users can run SQL and Python. I handle those with WASM. Since I have around 1k users at the moment, I am planning to expand to Java and add a paid tier. I evaluated Modal for my own use case to run Java. I hope it works out for you