threejs-boilerplate
threejs-boilerplate copied to clipboard
:fire: Three.js + TypeScript + SolidJS + Vite + Vitest :rocket:
Three.js Boilerplate
π₯ Three.js + TypeScript + SolidJS + Vite + Vitest π
Minimal, yet complete template for developing three.js projects.
π Structure
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
π Usage
ββSimply click Use this template and Create a new repository.
ββThis will initialize your own repository from this boilerplate.
β¨ Features
ββββοΈ Basic
βββββΒ β’ Cross-platform FaviconsβββββΒ β’ Meta tags for sharing on Facebook and Twitter
βββββΒ β’ Unsupported browser and disabled JavaScript screens
βββπ§© Components
βββββΒ β’ Application entry pointβββββΒ β’ Logo label component
βββββΒ β’ Current version tag
βββποΈ Sandbox
βββββΒ β’ 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.
βββπ¨ Shaders
βββββΒ β’ Custom shader support through vite-plugin-glsl.βββββΒ β’ Three.js shaders for ground plane material.
βββββΒ β’ Three.js shaders for custom tone mapping.
βββπ οΈ Utilities
βββββΒ β’ 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.
βββπ§° Miscellaneous
βββββΒ β’ Scoped SCSS and common easing functions.βββββΒ β’ Support for common 3D formats.
βββββΒ β’ Common assets folders.
βββββΒ β’ PWA-ready manifest.
βββββΒ β’ MIT license.
βββπ¦ Package Manager
βββββΒ This project was build withpnpm, 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.
βββπ Tests Coverage
βββββΒ All the code in thesrc/ directory has been fully tested and has a 100% code coverage.
ββββΒ Show me some numbers!
βββββΒ
πΎ Download
ββgit clone https://github.com/UstymUkhman/threejs-boilerplate.git
ββ
cd threejs-boilerplate
β¨οΈ Develop
ββpnpm i
ββ
pnpm start
βοΈ Lint
ββpnpm lint:js
ββ
pnpm lint:css
π§ͺ Test
ββpnpm test
ββ
pnpm test:watch
ββ
pnpm test:cover
π§± Build
ββpnpm build
ββ
pnpm serve
