SPACE.LA
◀ music select
personal / library / archived

PuerTS Three.js

TypeScript wrapper library (@puerts/threejs) exposing a Unity-compatible API over Three.js so the same code runs inside Unity via PuerTS and in the browser, with environment detection and left/right-handed coordinate conversion.

BPM
138
GRADE
B
LEVEL
5
RELEASES
0
YEARS
2025–2025

Same Code, Two Engines

On the same day I started the Teams mute tool I also started this: a TypeScript package called @puerts/threejs, built in a day in August 2025.

The idea was one codebase that runs in two very different places. PuerTS lets you script Unity in TypeScript, and Three.js gives you a scene graph in the browser. If you put a Unity-shaped API over Three.js, then Vector3, Quaternion, Transform and GameObject mean the same thing in both, and the same file can drive a Unity project or a web page. The library detects which environment it's in at runtime and routes accordingly.

The tricky part was handedness. Unity is left-handed and Three.js is right-handed, so every position, rotation and axis has to be converted at the boundary or the world ends up mirrored.

It was one of a bunch of 2025 experiments about separating the runtime from the renderer: Unity here, egui and AppKit in others.

led to

  • chuggie2026Unity-compatible API over three.js