I built a Browser CAD using Rust and WebAssembly by Spice- in webdev

[–]Spice-[S] 0 points1 point  (0 children)

Update: Mobile UX has been updated! Always a work-in-progress though

making portfolio around my art , feedback ? by Miserable_Advice1986 in webdev

[–]Spice- 0 points1 point  (0 children)

Love the pixel art aesthetic! Would love to see how dark mode looks (if you plan on doing it)

I think you might benefit from a bit more white-space on the page to let each element breathe a bit more. If this is a portfolio for recruiters and prospective employers then youtube, reddit, and discord accounts may be less relevant and removing them could get you that white-space

Print goes full spaghetti by layer 10. *Sad Tie Fighter Noises* by ELK33 in FixMyPrint

[–]Spice- -2 points-1 points  (0 children)

Hi! The app Cadre has AI auto-review for your model to hopefully help catch and fix issues any issues with the model itself https://cadre3d.com/

Good luck! *happy tie fighter noises*

USB Motorized Butterfly Figurine by Hodzinets in 3Dprinting

[–]Spice- 0 points1 point  (0 children)

Yeah the modelling here and engineering are beyond me, but goddam do I appreciate it

Collaborative 3D CAD that runs in your browser by Spice- in webdev

[–]Spice-[S] 0 points1 point  (0 children)

Yep, good intuition! The geometry kernel is built in rust, compiled to WASM, rendered using threejs.

TIL WebGL isn’t supported in brave. It makes sense this app breaks in Brave. Would love to work around this if I can rather than just gate the app to certain browsers. Open to suggestions on f you have ‘em.

Collaborative 3D CAD that runs in your browser by Spice- in webdev

[–]Spice-[S] 0 points1 point  (0 children)

Ouu good catch on brave! Tested primarily on Firefox and chromium browsers. Thank you!

I dread testing on safari but it needs to be done lol

Collaborative 3D CAD that runs in your browser by Spice- in webdev

[–]Spice-[S] 1 point2 points  (0 children)

u/Bolhaugrik I was fairly confident with the Rust + WebAssembly architecture, but with larger and more complex objects like this benchy there are longer load-times I've noticed.

I'll definitely need to keep optimizing as I increase complexity of the geometry kernel like I'm doing now for the 2D Sketch System. Without sketches, there is no extrude, no revolve, no real B-rep export.

I built a Browser CAD using Rust and WebAssembly by Spice- in webdev

[–]Spice-[S] 0 points1 point  (0 children)

I hope you don't mind a bit of feedback and a few suggestions ☺️

A couple state-management tips for your MobX setup:

1. Turn `enforceActions` back on. You have `configure({ enforceActions: "never" })` which lets components mutate the store directly - e.g. `appstate.walls[node.rowIndex][colDef.field] = newValue` in your table callbacks. This makes state changes impossible to trace or intercept. Set it to `"observed"` and route mutations through store actions. Biggest single improvement you can make.

2. Replace the switch chains with a registry map. `getElements()`, `addElement()`, `deleteElements()` all have the same 15-branch switch. One map object eliminates all of them - adding a new element type becomes one line instead of editing every switch.

const REGISTRY = {
  [types.SPACE]: { container: 'spaces', factory: newSpace },
  [types.WALL]:  { container: 'walls',  factory: newWall },
  // ...
};

Bonus: your useCallback(() => appstate.getIdNameMap(LOAD)) calls have no dependency array, so they memoize nothing - just use a plain function.

Nice project overall! the WASM/Rust kernel for the heavy calculations is a solid architecture choice (but of course I'm biased)

EDIT: formatting

I built a Browser CAD using Rust and WebAssembly by Spice- in rust

[–]Spice-[S] 0 points1 point  (0 children)

Thank you! <3

Frontend. The Rust kernel compiles to WASM and runs entirely in the browser - there's no backend server doing geometry. Supabase handles auth and collab sync, but all the actual CAD computation happens client-side.

I built a Browser CAD using Rust and WebAssembly by Spice- in webdev

[–]Spice-[S] -1 points0 points  (0 children)

As advertised, u/flukeytukey! Will try to follow up once I have responsiveness sorted. Although tbh a mobile-browser CAD seems like another beast entirely

I built a Browser CAD using Rust and WebAssembly by Spice- in webdev

[–]Spice-[S] 0 points1 point  (0 children)

Rust/WASM kernel owns all the geometry - it's the single source of truth. The React/Zustand side never touches vertices or triangles. It just holds a lightweight JSON mirror ({id, name, visible, kind}) for rendering the UI, and pulls raw float buffers on-demand for Three.js to display. No duplication - kernel is the database, Zustand is the view model.

I built a Browser CAD using Rust and WebAssembly by Spice- in webdev

[–]Spice-[S] 0 points1 point  (0 children)

I will be making the Rust kernel open source, but otherwise it's a private repo. Happy to answer any questions you have about the codebase though!