🔥 Three.js + TypeScript + SolidJS + Vite + Vitest 🚀
Minimal, yet complete template for developing three.js projects.
Three.js Boilerplate
├── __mocks__/
├── coverage/
├── dist/
├── node_modules/
├── public/
│ ├── assets/
│ ├── favicons/
│ ├── scripts/
│ ├── styles/
│ ├── browserconfig.xml
│ ├── manifest.json
│ ├── robots.txt
│ └── sitemap.xml
├── src/
│ ├── app/
│ ├── assets/
│ ├── components/
│ ├── sandbox/
│ ├── scss/
│ ├── shaders/
│ ├── utils/
│ ├── global.d.ts
│ └── main.tsx
├── tests/
│ ├── app/
│ ├── components/
│ ├── sandbox/
│ ├── shaders/
│ ├── utils/
│ ├── canvas.mock.d.ts
│ ├── canvas.mock.ts
│ └── global.spec.ts
├── index.html
├── package.json
├── tsconfig.json
├── vite.config.ts
└── vitest.config.ts
Simply click Use this template and Create a new repository.
This will initialize your own repository from this boilerplate.
• Cross-platform Favicons
• Meta tags for sharing on Facebook and Twitter
• Unsupported browser and disabled JavaScript screens • Application entry point
• Logo label component
• Current version tag • Simple three.js scene with:
◦ Linear Fog
◦ Ground Plane
◦ Orbit Controls
◦ Stats Monitoring
◦ Perspective Camera
◦ Default WebGL2 Renderer
◦ Ambient & Directional Lighting
• Scene configuration file with initial parameter values.
• Custom checkerboard-like ground plane material.
• GUI controls built on top of lil-gui
.
• Uncharted 2 tone mapping shader.
• Three.js shaders for ground plane material.
• Three.js shaders for custom tone mapping. • Assets loading manager:
◦ Promise based APIs
◦ Loading errors logging
◦ Start, Progress & Complete loading events
◦ usePublicFolder
option for setting assets path
◦ Audio, GLTF/GLB, CubeTexture & Texture loaders
• Array, Color, Number, String & deepFreeze
methods.
• Elastic Number, Vector3 and Vector3 classes.
• Custom Events and EventEmitter manager.
• Mouse Wheel normalization function.
• debounce
and throttle
functions.
• requestAnimationFrame
manager.
• Custom Web Worker manager.
• Unity-like Vector3
directions.
• Spline interpolation manager.
• Screen Viewport manager.
• Support for common 3D formats.
• Common assets folders.
• PWA-ready manifest.
• MIT license. This project was build with
pnpm
, but yarn
and npm
are also supported.Just replace
pnpm
in all commands below with yarn
or npm run
.For
npm
users, one exception is the installation, where it's npm i
.
All the code in the src/
directory has been fully tested and has a 100% code coverage.