Library / SDK
fengyanhao/3D_Magnetic_Pieces avatar
fengyanhao/3D_Magnetic_Pieces

3D Magnetic Pieces: a browser magnetic-tile builder with a deterministic geometry engine and validation

An open-source interactive 3D magnetic tile building and tutorial platform for children and parents, built with React, TypeScript and Three.js.

311 stars34 forksTypeScriptMIT

At a glance

What is it?
3D Magnetic Pieces is an MIT React and Three.js platform pairing guided magnetic-tile tutorials with a browser 3D editor and a deterministic geometry engine. It is aimed at children and parents, and it validates pieces, connections and construction steps rather than only rendering them.
Who is it for?
Use 3D Magnetic Pieces if you want guided, browser-based magnetic-tile building for children with a deterministic geometry engine that actually validates pieces, connections and construction steps, or if you are a developer wanting an extensible, well-tested React and Three.js codebase for magnetic-tile geometry: the validation layer and the unit-plus-Playwright test coverage are its real strengths.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 91 days ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • fengyanhao/3D_Magnetic_Pieces311 ★ · +6
Star history
Repository2026-09-192026-11-25
fengyanhao/3D_Magnetic_Pieces305311

6 Stars in the last 67 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Guided tutorials plus a real 3D editor

3D Magnetic Pieces is an open-source interactive platform for building with magnetic tiles, aimed at children and parents. The README describes it as combining guided magnetic-tile tutorials with a browser-based 3D editor and a deterministic geometry engine, so families can explore models step by step while contributors can extend the model catalog, connection rules, validation logic and learning experience.

The user is a parent or child working through magnetic-tile builds, and, on the other side, a developer who wants to add models or rules. That dual audience shapes the project: it is a learning app for families and a maintainable codebase for contributors, with unit and Playwright end-to-end tests covering models, routes, rendering and editor workflows.

What makes it more than a toy demo is the deterministic geometry engine and the validation layer. The README lists physical and semantic checks for pieces, connections, construction steps and model integrity, which means the app does not just draw tiles, it verifies that a build is geometrically valid. That is an unusual amount of engineering for a children's building app, and it is built on React 18, TypeScript, Vite and Three.js with react-three-fiber. It is MIT licensed and bilingual, English and Chinese.

A deterministic engine that checks builds, not just renders them

The technical heart is the pairing of a deterministic geometry engine with validation. Determinism matters for a construction app because it means the same build produces the same geometry every time, which is what makes step-by-step tutorials reliable: a tutorial step can be defined against an exact, reproducible geometric state rather than something that might render differently across runs.

The README's validation is layered into physical and semantic checks across pieces, connections, construction steps and model integrity. Checking connections and construction steps, not just individual pieces, is what lets the app tell a learner whether tiles actually fit together as a magnetic tile physically would, and whether a construction sequence is coherent. That turns the editor from a free-form 3D toy into something that can guide and correct.

The 3D scene is built with Three.js through react-three-fiber and drei, with the magnetic-tile scene as a dedicated component. The desktop editor exposes geometry, connection, serialization and validation tools, so a build can be created, saved and checked. For a contributor, the separation of the catalog, connection rules and validation logic into extensible pieces is the design that makes adding a new model or rule tractable rather than a rewrite.

Running it locally

3D Magnetic Pieces runs as a standard Vite web app, with a Windows convenience script on top. The README's one-click Windows path is to double-click a `.cmd` launcher that checks the port, installs missing dependencies, starts the dev server and opens the browser, with a companion script to stop it.

The cross-platform development commands are the usual npm flow, which the README lists:

bash
npm install
npm run start-site
npm test
npm run test:e2e
npm run build

`npm run start-site` starts the site on port 5174, `npm test` runs unit tests in watch mode, `npm run test:e2e` runs the Playwright end-to-end tests, and `npm run build` type-checks and creates a production build. You then open the app at `http://localhost:5174/`. The requirements are Node.js 20 or later and npm 10 or later.

Because the app uses `BrowserRouter`, the README is explicit that static hosting needs an SPA fallback to `index.html`, and it ships the config for that: a `vercel.json` rewrite for Vercel, a `netlify.toml` redirect for Netlify, and a documented Nginx `try_files` rule. That attention to deployment fallback is a small but telling sign that the project is meant to actually be hosted, not just run locally.

The limitations: a focused domain and a browser 3D dependency

The honest limitations follow from what the app is. It is a magnetic-tile building and learning platform, so its scope is that specific domain: the geometry engine, the connection rules and the catalog are all about magnetic tiles, not general 3D modeling. That focus is what enables the validation, but it means the app is not a general-purpose 3D editor.

As a browser 3D application built on Three.js, it depends on the browser's WebGL support and the device's graphics capability. On a low-powered device, or one with weak 3D support, the editor and tutorials may be constrained, which is inherent to real-time 3D in the browser rather than a flaw in the code. The README's responsive UI targets desktop, tablet and mobile, but 3D performance still varies by hardware.

The deterministic-engine-plus-validation design is a strength, but it also sets a boundary: the app validates against its own model of magnetic-tile physics and semantics, so its correctness is relative to that model. For a learning app that is exactly right, but a contributor extending the connection rules is working within, and responsible for, that model's assumptions, which is where the extensibility the README highlights carries real design responsibility.

Against a physical magnetic-tile set or a generic 3D toy

The alternatives are physical magnetic tiles, or a generic browser 3D building toy. Physical tiles are the real thing, tactile and screen-free, but they cannot guide a build step by step, check whether a construction is valid, or offer a catalog of tutorials, and they cost money per set. A generic 3D building toy lets you place shapes but has no notion of magnetic-tile connection rules or validation.

3D Magnetic Pieces sits between them: it gives guided tutorials, a catalog, and a deterministic engine that validates pieces, connections and construction steps, all free and in the browser. The cost is that it is a screen experience rather than physical play, and it is bounded to the magnetic-tile domain. Choose physical tiles for hands-on, screen-free building. Choose a generic 3D toy if you want free-form shape play without rules. Choose 3D Magnetic Pieces when you want guided, validated magnetic-tile learning for children in the browser, or when you are a developer who wants an extensible, well-tested codebase for magnetic-tile geometry to build on.

MIT, tested and extensible, and where to start

3D Magnetic Pieces is MIT, so it can be forked, self-hosted and extended with attribution, which suits a project that explicitly invites contributors to extend the catalog, connection rules and validation logic. The presence of both unit and Playwright end-to-end tests, covering models, routes, rendering and editor workflows, is what makes that extensibility safe: a contributor changing a rule has tests to catch a regression, which is more test discipline than most hobby web apps carry.

Upgrade cost is the ordinary Vite and React one, and the SPA-fallback configs for Vercel, Netlify and Nginx mean deploying an updated build is straightforward on common hosts. Node.js 20 or later is the baseline.

The concrete first step is to run it and see the validation in action: `npm install`, `npm run start-site`, and open `http://localhost:5174/` to work through a tutorial and try the desktop editor, watching how the engine checks connections and construction steps rather than only rendering tiles. If you intend to contribute, run `npm run test:e2e` to confirm the Playwright suite passes on your setup, since that test coverage is what makes extending the catalog and rules maintainable, and read CONTRIBUTING.md for the workflow before changing the geometry or validation logic.

Editorial conclusion

Use 3D Magnetic Pieces if you want guided, browser-based magnetic-tile building for children with a deterministic geometry engine that actually validates pieces, connections and construction steps, or if you are a developer wanting an extensible, well-tested React and Three.js codebase for magnetic-tile geometry: the validation layer and the unit-plus-Playwright test coverage are its real strengths. It is the wrong choice if you want screen-free physical play, or a general-purpose 3D editor, since it is scoped to the magnetic-tile domain and depends on browser WebGL performance. Start by running npm install and npm run start-site and opening http://localhost:5174/ to see the engine validate a build, and run npm run test:e2e plus read CONTRIBUTING.md before extending the catalog or rules.

Frequently asked questions

What is 3D Magnetic Pieces built with?

The README lists React 18 and TypeScript, Vite 8, Tailwind CSS, and Three.js with react-three-fiber and drei for the 3D scene, plus Vitest and Playwright for testing. It is an MIT-licensed browser platform for magnetic-tile building and tutorials.

How do I run 3D Magnetic Pieces locally?

The README says to run npm install then npm run start-site and open http://localhost:5174/, needing Node.js 20 or later and npm 10 or later. On Windows there is also a one-click .cmd launcher that checks the port, installs dependencies and opens the browser.

Does 3D Magnetic Pieces check whether a build is valid?

Yes. The README says it includes a deterministic geometry engine with physical and semantic checks for pieces, connections, construction steps and model integrity, so it validates a build rather than only rendering it.

Official sources

  1. fengyanhao/3D_Magnetic_Pieces on GitHub
  2. License: MIT
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/fengyanhao-3d-magnetic-pieces.svg)](https://hysenlabs.com/projects/fengyanhao-3d-magnetic-pieces)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/fengyanhao-3d-magnetic-pieces.svg)](https://hysenlabs.com/projects/fengyanhao-3d-magnetic-pieces)

Was this useful?