In order for CadHub to be able to host multiple different Cad packages (OpenSCAD, CadQuery, JSCAD etc) we have to keep the IDE architecture agnostic, which is achieved by adding a light wrapper to each package to force it to have uniform inputs and ouputs, namely it's expected to take code and optionally customizer values as inputs and to return a 3d-artifact, logs and optionally customizer params. Here's how it interact with the IDE visually.
The entry points of the wrappers are in
app/web/src/helpers/cadPackages/<package-name>/<package-name>Controller.tsx it's this typescript file that is responsible for enforcing the uniform inputs and outputs, but within the file it's able to do whatever it needs todo, i.e. spin up a worker in the case of JSCAD or make a server call in the case of OpenSCAD and CadQuery. The file should export a render function and in order to help with the inputs and outputs for those looking to add a new integration, there is
demoController.ts as an example and typing for the render function.
OpenSCAD and CaqQuery packages by using each of the packages respective CLIs deployed with docker on AWS's container lambdas using the serverless framework, the endpoint that these deployments make is what the wrappers above send requests to. For more information as to how this is setup see this readme.