It's been long since I last had the fun of any serious programming(being all night awake with loud music on headphones and lots of snacks infront) due to admission studies. I'm missing it a lot. So after the exams are done I wish to improve MathMash a lot and also start a pet project of some sort. First thing that came to my mind is to build a small cute OJ. I'm aware that we have plenty of OJs already and they are more than enough helpful. So this project won't be of much use to anyone. But it'll be fun to design and build an entire OJ from scratch and also learn lots of new stuff along the way.
So I did a light research yesterday about what I might need to learn to build it. The first obvious thing needed is of course a way to execute submitted codes. I tried to go with the easiest option first: Using some third-party service/api so that I can give them the code and receive the output. But there doesn't seem to be any free option of this kind. Ideone used to provide a free api I guess, but now they use Sphere-Engine. And I found out Sphere-Engine costs roughly $100+/month for their service. That's way too high for a non-profit pet project.
Another known option to me is to save the submitted code in a temp file in the server, execute it, and then return the result. But I read somewhere that it's not as easy as it sounds, as there are a lot of security concerns to be dealt with. And I don't have any knowledge about how to safely run a possibly malicious code.
I can also do something like what vjudge does, execute the problem in the respective sites and then scrape the submissions page to fetch the result. But it's kind of an unstable solution, as I'll have to update the whole process of scraping whenever the respective site updates their site structure.
I'm sure a lot of you have created an OJ or did some research on how to do so in the past. Can you kindly show me any idea on how to solve this problem? It'll be really helpful. Thanks in advance!