Web tool that turns uploaded STLs into Gridfinity bins with the STL as a cavity. Bun + R3F + OpenSCAD.
Find a file
Filip Kin 4f73f6a6e0 Auto arrange / Fit bin use post-bake bboxSize instead of original upload bbox
After baking a rotation (e.g. tipping a 100mm tall tool to lie flat),
the placement's bboxSize is updated to the oriented dimensions (e.g.
100x10x10 -> the tool is now 100mm wide, 10mm tall). But Auto arrange
and Fit bin were still pulling sizes from upload.bbox (the un-rotated
original), so they'd reserve a 10x10x100 cell for a flat tool and the
Z exposure math would target the original height.

Switch both helpers to prefer obj.bboxSize, falling back to upload.bbox
only if the placement hasn't been initialized yet.

Also: object-row subtitle now uses the same effective bboxSize and
appends '(baked)' when there's an active bakedRotation, so the
displayed dimensions match what layout will see.
2026-05-26 14:47:32 -04:00
scad/gridfinity-rebuilt-openscad Initial scaffold: Bun + R3F frontend, OpenSCAD backend, vendored gridfinity-rebuilt-openscad 2026-05-26 01:43:57 -04:00
src Auto arrange / Fit bin use post-bake bboxSize instead of original upload bbox 2026-05-26 14:47:32 -04:00
.dockerignore Initial scaffold: Bun + R3F frontend, OpenSCAD backend, vendored gridfinity-rebuilt-openscad 2026-05-26 01:43:57 -04:00
.gitignore Initial scaffold: Bun + R3F frontend, OpenSCAD backend, vendored gridfinity-rebuilt-openscad 2026-05-26 01:43:57 -04:00
bun.lock Initial scaffold: Bun + R3F frontend, OpenSCAD backend, vendored gridfinity-rebuilt-openscad 2026-05-26 01:43:57 -04:00
deploy-nginx.conf.example v0.2: fix STL preview centering, add center/fit/drop buttons, separate render+download, Authelia in nginx 2026-05-26 02:07:49 -04:00
docker-compose.yml Add docker-compose for local deployment 2026-05-26 01:44:36 -04:00
Dockerfile Use OpenSCAD 2025.07.20 AppImage in Docker (apt 2021.01 is too old for gridfinity-rebuilt-openscad v2) 2026-05-26 01:56:24 -04:00
index.html Initial scaffold: Bun + R3F frontend, OpenSCAD backend, vendored gridfinity-rebuilt-openscad 2026-05-26 01:43:57 -04:00
package.json Initial scaffold: Bun + R3F frontend, OpenSCAD backend, vendored gridfinity-rebuilt-openscad 2026-05-26 01:43:57 -04:00
README.md Initial scaffold: Bun + R3F frontend, OpenSCAD backend, vendored gridfinity-rebuilt-openscad 2026-05-26 01:43:57 -04:00
tsconfig.json Initial scaffold: Bun + R3F frontend, OpenSCAD backend, vendored gridfinity-rebuilt-openscad 2026-05-26 01:43:57 -04:00
vite.config.ts Initial scaffold: Bun + R3F frontend, OpenSCAD backend, vendored gridfinity-rebuilt-openscad 2026-05-26 01:43:57 -04:00

gridfinity-tool

Web tool that turns uploaded STL files into Gridfinity bins by using the STLs as cavities. Arrange multiple parts on the bin, add text labels (debossed into the floor or embossed on top), and export the final bin as an STL ready to print.

Built with Bun + React + Three.js (frontend) and OpenSCAD + gridfinity-rebuilt-openscad (backend renderer).

Local dev

Requires bun and openscad (or openscad-nightly) on PATH.

bun install
bun run dev

The Vite dev server runs on :5173 and proxies /api to the Bun server on :8090.

Render flow

  1. Upload one or more .stl files.
  2. Arrange them on the bin (drag via gizmo, or numeric inputs). Set per-STL oversize % for tolerance.
  3. Optionally add text labels (deboss = cut into bin floor, emboss = raised on top).
  4. Hit Render & Download STL. Server writes a .scad file referencing the uploaded STLs, runs OpenSCAD, returns the resulting STL.

Deploy (Coolify)

  • Docker build context = repo root, Dockerfile = ./Dockerfile.
  • Port: 8090.
  • Domain: gridfinity.filipkin.com (HTTPS via Coolify).
  • Persistent volume on /app/tmp if you want session uploads to survive container restarts (otherwise they're scratch).

How oversize works

The "oversize %" on each STL is applied as a uniform scale() around the STL's centroid before subtraction. This is fast and good enough for tolerance values of 15%. For dimensionally critical cavities, model the tolerance into the STL beforehand.

Library

scad/gridfinity-rebuilt-openscad/ is vendored from upstream. Update by:

cd scad/gridfinity-rebuilt-openscad
git pull

Layout

src/
  shared/types.ts       # BinConfig, PlacedObject, etc. shared between client + server
  server/
    index.ts            # Bun HTTP server, static + API
    sessions.ts         # tmp/ session lifecycle
    scad.ts             # builds the .scad file from a BinConfig + objects
    openscad.ts         # spawns openscad CLI
  client/
    main.tsx, App.tsx, styles.css
    lib/store.ts        # zustand state
    components/
      Sidebar.tsx       # bin config, uploads, per-object controls
      Scene.tsx         # R3F canvas
      BinPreview.tsx    # transparent bin walls
      PlacedObjects.tsx # draggable STLs + text labels (TransformControls)
scad/gridfinity-rebuilt-openscad/   # vendored library
tmp/                                # per-session uploads and rendered output