r/reactjs • • Oct 08 '26

Show /r/reactjs I built a local-first React workspace with IndexedDB and a persistent Three.js environment

I've been building Ikigai Space, a personal workspace that combines planning, focus, reflection, and memory with a persistent interactive 3D environment.

The interesting part from a React perspective has been making the practical UI and 3D experience coexist without either feeling disconnected.

The stack: - React 19 + TypeScript + Vite - Dexie / IndexedDB for local persistence - React Three Fiber + Three.js for the 3D environment - Framer Motion for interface transitions - PWA support and Tauri 2 for Windows

The 3D environment, called Sanctuary, reflects activity elsewhere in the application. I deliberately avoided XP, achievements, and traditional gamification.

One performance concern I've encountered is the React Three Fiber dependency chunk, currently around 910 kB minified. The production build succeeds, but I'm interested in improving how the 3D experience loads.

I'm considering the trade-offs between route-level lazy loading, code splitting, and profiling real loading behavior before restructuring things.

Source code: https://github.com/ananta-sj/ikigai-space

Live demo: https://ananta-sj.github.io/ikigai-space/

I'd appreciate technical feedback from React developers, particularly around managing a persistent 3D experience alongside a local-first application.

How would you approach this architecture and its loading-performance trade-offs?

0 Upvotes

6 comments sorted by

1

u/johnnyfortune Oct 08 '26

Im on a mac and I was having trouble clicking the benches, or interacting with the 3d space. Other than that it looked really cool. I didnt have much time to check it out beyond that.

8

u/jakiestfu Oct 08 '26

Wtf even is this it’s just words mate I can’t even tell what this is by the homepage

-2

u/itaybuilds Oct 08 '26

Your repo already has the first split I'd reach for: GardenPage is lazy-loaded at the router, so that 910 kB chunk isn't on the initial route. I wouldn't add another React.lazy boundary until profiling shows that entering /garden blocks long enough to matter.

One detail does look worth changing: preloadSanctuaryAssets() currently runs in a SanctuaryWorld effect. The four GLBs therefore start loading only after the Three/R3F chunk has downloaded, parsed and mounted, so the preload cannot improve the first Garden entry much. If that first entry is slow, warm the GardenPage import on nav hover or idle, then start the GLBs when the user signals intent to enter the garden. Keep the shell interactive and show actual loading progress instead of a blank canvas.

Measure three costs separately: compressed JS transfer, JS parse/long tasks, and GLB decode/GPU upload. "910 kB minified" doesn't tell you which one users feel. In Tauri, transfer is local, but parse, shader compilation and GPU upload still matter. Your current frameloop="never" while inactive is a good guard; I'd keep it and avoid remounting the Canvas if people move between garden subviews often.

AI-assisted (OpenAI GPT-5.6). I checked the current App.tsx, GardenPage, SanctuaryWorld and SanctuaryAssets code before writing this; I did not run the app or profile it.

-2

u/[deleted] Oct 08 '26

[removed] — view removed comment

-2

u/MeanManagement834 Oct 08 '26

Thanks, that's really helpful! I'm not using any custom Tauri-side pre-caching for Sanctuary right now, so loading is mostly handled by the renderer.

I'll definitely profile the initial load before changing things. The idea of preloading after Dexie initializes is interesting too.

Did you find preloading JS or the actual 3D assets made a bigger difference?