I'm developing a website where users can write or upload code to be executed, somewhat like platforms such as Leetcode or Codeforces. I'm seeking advice on how to implement this safely and cost-effectively. Is it possible to use a hosting service that can provide a secure environment, like a sandbox, to run this kind of user-generated code? Any insights or recommendations would be greatly appreciated!
3 Answers
Instead of trying to build your own system from scratch, consider using an open-source solution to navigate the security challenges of running user code. Judge0 is a solid option that you can self-host or access via their API, and then there's also Piston, which might fit your needs.
As someone who's fairly new, I'd say this project might be a bit beyond the typical beginner level. It's a complex task that even experienced developers might struggle with, so proceed with caution.
Are we aiming high here? Writing your own interpreter for a secure user code execution environment is definitely not a starter project—it can get very complicated. You're better off using pre-built solutions or focusing on simpler projects to gain experience first.

You're right, I should stick to existing resources rather than trying to create everything myself!