44eb5832 2026-04-12 Pavel Safronov | 1 | # nuts |
| 2 | |
| 3 | > A phone-focused full-screen toy: a box of hex nuts bouncing around with haptic feedback. |
| 4 | |
| 5 | ## Features |
| 6 | |
| 7 | - **Physics** — [Matter.js](https://brm.io/matter-js/) 2D rigid-body simulation |
| 8 | - **Haptics** — Web Vibration API fires on every wall impact (intensity scales with collision speed) |
| 9 | - **Tilt gravity** — Device orientation rotates the gravity vector so nuts roll as you tilt your phone |
| 10 | - **Shake** — DeviceMotion events detect shakes and punt all nuts with a random impulse + double-vibrate |
| 11 | - **Configurable** — Slider to set 1–50 nuts; reset positions on demand |
| 12 | - **Offline-ready** — No server, no data, runs entirely in the browser |
| 13 | |
| 14 | ## Tech stack |
| 15 | |
| 16 | - [pnpm](https://pnpm.io/) + [TypeScript](https://www.typescriptlang.org/) |
| 17 | - [Vite](https://vitejs.dev/) — dev server and bundler |
| 18 | - [Matter.js](https://brm.io/matter-js/) — 2D physics engine |
| 19 | |
| 20 | ## Development |
| 21 | |
| 22 | ```bash |
| 23 | pnpm install |
| 24 | pnpm dev # http://localhost:5173 |
| 25 | pnpm build # production bundle → dist/ |
| 26 | pnpm preview # preview dist/ build |
| 27 | ``` |
| 28 | |
| 29 | ## Deployment |
| 30 | |
| 31 | Hosted on GitLab Pages via `.gitlab-ci.yml`. Pushes to the default branch trigger a build and publish `dist/` as the Pages site. |
| 32 | |
| 33 | If your project is in a GitLab group/subgroup the Vite `base: './'` config ensures assets resolve correctly under the Pages sub-path. |