Replies: 3 comments 5 replies
-
It's worth noting that I'm more of a front end dev, so backend architecture is not something I'm super comfortable with. Any input would be appreciated. |
Beta Was this translation helpful? Give feedback.
-
My personal opinion (without actual exploration of prices) is that all those cloud fancy stuff is just so you pay 10x for resources in exchange for their management, although at the start it can be cheaper and a good option, I would suggest you look into running workers on standalone server (can be your PC for test). just look at what a beast you can rent for EUR 40 monthly (65 AUD) If you have a setup that can take-over part of the work on standalone server (or for test your PC), you can get better idea how much a standalone server can do and depending on scale you can even use both cloud and standalone options. If you prepare yourself a system where you can combine lambdas, and standalone server, then you are free to offset work to which ever option is cheaper, or easier to maintain at certain point in time. |
Beta Was this translation helpful? Give feedback.
-
@mrhut10 Had a suggestion of using websockets to keep a persistent connection to the browser for longer running tasks. |
Beta Was this translation helpful? Give feedback.
-
There are a few issues with the current implementation of the CAD part of the backend. However, it needs to change anyway to cover upcoming requirements, so it makes sense to address them together and have a rethink of the backend architecture.
Current stack:
First of all this is a Redwood app, and setup in a pretty standard fashion at least for all of the persistent user data, projects etc (I don't think there's much point going over this part of the app in detail, in a single sentence it's: Using prisma as an ORM, connecting to a postgres db and has a graphQL interface to the client). Where it departs from standard redwood is for the model rendering because the packages can't run in an off-the-self node lambda like the rest of the app. Docker was an obvious choice since it allows us the set up the environment however we need to integrate current or future CAD packages (currently CadQuery and OpenSCAD), before I explain more, I'll give a run down of how our IDE works as relevant context.
The aim from the beginning was to make an agnostic or universal CAD IDE, to allow us to keep adding integrations without being couple to any one package in particular. The IDE is made up of 4 pieces of UI; Editor, Console, 3D-viewer and the customizer.
The way that the CAD packages interact with the IDE is like so:
By adding a light wrapping to each or the CAD packages to give a uniform interface (inputs of code, and optionally customizer values and outputs of a 3D artifact, logs and optionally customizer params) has worked well. It's not entirely that clean, there are some important differences between the outputs of the different packages. CadQuery outputs STL files (hoping to support STEP file and tesselate in the browser soon), JSCAD outputs three.js primitives directly, and while OpenSCAD can output STLs, by default it instead sends preview images from the same perspective as the three.js camera because STL rendering can be much slower ( good example is this moving fish, that's able to send through a preview image relatively quickly, but takes 10 minutes to create an STL when ran locally on my machine)
How are the models rendered?
Like I said we're using docker but more specifically we're using AWS's container lambdas to stick with a serverless architecture. The flow is like:
One extra nuance here is that before the aritfact is generated, we check if it already exists in S3, which can be done because the key its stored under is a hash of the code used to generate it.
What are the problems with this current setup?
What's needed going forward?
Beta Was this translation helpful? Give feedback.
All reactions