Save Three.js Canvas as an html file

So I’m looking to store my 3js scene and dat-gui into a database as an html file, but cant seem to find any insight on where to start online so I figured I would ask here. I essentially need to keep all interactivity within the scene, and interactivity of dat.gui in place. Any ideas on where to start my search would be greatly appreciated!

Regarding the title: “Save Three.js Canvas as an html file”.

This is technically not possible. You can only save the current contents drawn on a canvas as an image or as some sort of binary/base64 data. But if you reload the site, drawing the image back to the canvas isn’t much helpful if you want to continue rendering the 3D scene.

So you should instead save the three.js scene via scene.toJSON() and restore it via ObjectLoader. This is how the three.js editor is saving and restoring scenes.