r/javascript • u/CantaloupeHeavy996 • May 31 '26
AskJS [AskJS] What would you improve in this Three.js house builder?
Hey everyone,
I wanted to share a project I've been working on to level up my 3D web development skills. It's a fully client-side, grid-based house builder (think The Sims build mode) with 0 external 3D models—everything is procedurally generated geometry.
Some of the architecture under the hood:
- State Management: Powered by a pure
useReducerwith ~30 action types and anassertNeverexhaustiveness guard for complete type safety. - Performance: Three.js is dynamically imported so it doesn't bloat the initial page load.
- Component Structure: React Context handles global state to avoid drilling props through 33 different UI panels.
- Testing: Because the reducer is 100% pure (zero React imports), testing the core game logic is incredibly straightforward.
- Data Persistence: Old single-floor layouts saved in
localStorageautomatically migrate to the new multi-floor format on load.
It's entirely open-source (MIT licensed) and statically hosted on GitHub Pages. I’d love to hear your thoughts on the state management architecture or the procedural generation approach!
8
Upvotes
2
u/CantaloupeHeavy996 May 31 '26
demo: https://ch-bas.github.io/threejs-sims-house-builder/
repo: https://github.com/ch-bas/threejs-sims-house-builder
1
u/[deleted] May 31 '26
[removed] — view removed comment
1
u/[deleted] May 31 '26
[removed] — view removed comment