Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ustymukhman/threejs-boilerplate

:fire: Three.js + TypeScript + SolidJS + Vite + Vitest :rocket:
https://github.com/ustymukhman/threejs-boilerplate

boilerplate pnpm solidjs template threejs typescript vite vitest webgl webgl2

Last synced: 3 months ago
JSON representation

:fire: Three.js + TypeScript + SolidJS + Vite + Vitest :rocket:

Awesome Lists containing this project

README

        

# Three.js Boilerplate #

πŸ”₯ [Three.js](https://threejs.org/) + [TypeScript](https://www.typescriptlang.org/) + [SolidJS](https://www.solidjs.com/) + [Vite](https://vitejs.dev/) + [Vitest](https://vitest.dev/) πŸš€

> Minimal, yet complete template for developing three.js projects.

![](https://img.shields.io/github/package-json/dependency-version/UstymUkhman/threejs-boilerplate/three?style=flat-square)
![](https://img.shields.io/github/package-json/dependency-version/UstymUkhman/threejs-boilerplate/dev/typescript?style=flat-square)
![](https://img.shields.io/github/package-json/dependency-version/UstymUkhman/threejs-boilerplate/solid-js?style=flat-square)
![](https://img.shields.io/github/package-json/dependency-version/UstymUkhman/threejs-boilerplate/dev/vite?style=flat-square)
![](https://img.shields.io/github/package-json/dependency-version/UstymUkhman/threejs-boilerplate/dev/vitest?style=flat-square)

![](https://img.shields.io/github/deployments/UstymUkhman/threejs-boilerplate/github-pages?style=flat-square)
![](https://img.shields.io/badge/coverage-100%25-brightgreen?style=flat-square)
![](https://img.shields.io/github/repo-size/UstymUkhman/threejs-boilerplate?color=yellowgreen&style=flat-square)
![](https://img.shields.io/github/package-json/v/UstymUkhman/threejs-boilerplate?color=orange&style=flat-square)
![](https://img.shields.io/github/license/UstymUkhman/threejs-boilerplate?color=lightgrey&style=flat-square)

[![](./public/assets/images/preview.jpg)](https://ustymukhman.github.io/threejs-boilerplate/dist)

## πŸ“‚ 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 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.

β€ƒβ€ƒβ€‚πŸ“ˆ Tests Coverage


      All the code in the src/ directory has been fully tested and has a 100% code coverage.



     Show me some numbers!



      Tests Coverage


πŸ’Ύ 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