Skip to content

Packs / threejs-public

r3f-starter

Start a react-three-fiber scene (React 18 + @react-three/fiber + drei) without a build step, ready to move into a Vite app

Install

logicpacks pack use threejs-public/r3f-starter
get_pack threejs-public/r3f-starter

The second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.

Keys it needs (names only)

None.

Playbooks included

  • Spec: spec/SPEC.md (goal, steps, edge cases, don’ts)
  • Routes: esm-localvite
  • Checks: 1 in outcome/checks.yaml
  • Code: App.jsindex.html
  • Tools: python3, playwright-python, chromium

Usage, last 8 weeks

New: no recorded use yet.

Purpose (from spec/SPEC.md)

Goal

A minimal R3F app (Canvas, lights, a spinning mesh, OrbitControls from drei) loaded from esm.sh, plus the Vite command for a real project.

Steps

  1. Prototype: serve code/ (React, R3F and drei from esm.sh, pinned versions).
  2. Real project: npm create vite@latest app -- --template react then npm i three @react-three/fiber @react-three/drei and copy App.js logic.
  3. Use useFrame for animation; keep state out of the render loop.
  4. Check: python3 ../tools/webgl_check.py code --js "window.__r3f === true".

Edge cases

  • esm.sh must dedupe react: the import map pins one React for all packages (?deps=).
  • R3F v8 pairs with React 18; R3F v9 with React 19.

Don'ts

  • Don't setState inside useFrame.
  • Don't ship the esm.sh prototype to production; bundle with Vite.