Chapter 845: Setup (Manual)
Core Idea
WebGL can't load local image files directly for security reasons, so three.js development requires running a local web server — which is quick and easy to set up with several lightweight options.
Key Concepts
- Why a server is required: browsers block WebGL from reading images off the local filesystem directly; files must be served over HTTP even during local development.
- Servez: a simple GUI local server — point it at a project folder, click start, and browse to
http://localhost:8080/.
- Node.js-based
servez CLI: installed via npm, serves the current folder (or a specified path) the same way from the command line.
- Any static server works: the specific tool doesn't matter — any simple local HTTP server serving the project folder is sufficient for three.js development.
Code Examples
cd path/to/project
servez
- What it demonstrates: starting a local static server from the command line, then browsing to
http://localhost:8080/.
Key Takeaways
- Always serve three.js projects over a local HTTP server during development — opening HTML files directly (
file://) won't work for loading textures/models.
- Servez (GUI) and the
servez npm package (CLI) are both simple zero-config options for this.
- Any static file server works equally well; the choice is purely about developer preference.
Connects To
- Installation (manual): the npm/build-tool and CDN setup paths both still need a local server for development.