Web Essentials for 3D Developers
A practical introduction to the web stack — Node.js, npm, TypeScript, and Vite — for Unity and Blender developers building with Needle Engine.
If you come from Unity or Blender, you already think in scenes, components, and assets. The web adds one more layer: a build toolchain that packages everything into something browsers can run. This guide walks you through it — no prior web experience needed.
By the end you'll understand:
What Node.js and npm are and why you need them
What
package.jsonandpackage-lock.jsondoHow TypeScript fits in and why it's used
What Vite does and when you interact with it
How all of this maps to the familiar Unity/Blender workflow
:::tip Just want the files explained? See Project Structure for a file-by-file reference of the web project. :::
The web runtime in one sentence
A Needle Engine project compiles your TypeScript components + 3D assets + HTML into a folder of static files that any browser can open — no plugin, no install, just a URL.
Node.js — the engine room
Node.js lets JavaScript run on your machine (outside a browser). Needle Engine uses it at development time to:
Run the local dev server (
npm run dev)Compile TypeScript to JavaScript
Bundle and optimise files for production (
npm run build)
Node.js does not run in the final browser build — it's purely a development tool, like Unity's Editor process.
:::tip Check your install
If either command fails, download Node.js (LTS version recommended). :::
npm — the package manager
npm (Node Package Manager) ships with Node.js. It downloads and manages the libraries your project depends on.
npm
Package Manager
—
package.json
Packages/manifest.json
—
node_modules/
Library/
—
package-lock.json
.meta files
—
Scaffolding a new project
This is the fastest way to start a standalone Needle Engine project from the terminal — no Unity or Blender required. It asks a few questions (project name, framework) and generates a ready-to-run web project for you:
The core npm commands
Needle runs these for you automatically when you press Play or click Build in Unity/Blender. You only need to run them manually when working directly in the terminal.
package.json — your project's manifest
Every web project has a package.json at its root. Open it and you'll find:
scripts— shortcuts for terminal commands.npm run devruns the"dev"entry.dependencies— libraries needed at runtime (Needle Engine, three.js).devDependencies— tools needed only during development (TypeScript, Vite).
You rarely edit this by hand. When you add a package via npm install some-library, npm updates it automatically.
package-lock.json
package-lock.json is automatically generated and records the exact version of every installed package (including sub-dependencies). Never edit it manually — but always commit it to git. It ensures every team member and your CI/CD pipeline installs identical versions.
TypeScript — JavaScript with types
Needle Engine components are written in TypeScript (.ts files). TypeScript is JavaScript with optional type annotations — it compiles to plain JavaScript before running in the browser.
Why TypeScript instead of plain JavaScript?
Errors are caught while you type, not at runtime
Your editor can autocomplete component properties and methods
It mirrors C# enough that Unity developers feel at home
You don't need to manually compile TypeScript — Vite handles that automatically when the dev server is running.
:::tip New to TypeScript? TypeScript Essentials covers the language fundamentals in about 20 minutes. :::
Vite — the build tool
Vite is the development server and bundler for Needle Engine projects. Think of it as Unity's background compilation process — it watches your files and rebuilds instantly when something changes.
What Vite does
Serve the local site at https://localhost:3000
npm run dev
Hot-reload when you save a file
Automatic while dev server runs
Compile TypeScript → JavaScript
Automatic
Bundle everything into dist/ for deployment
npm run build
vite.config.js
The vite.config.js file at the project root configures Vite. Needle adds its own plugin here so the build works out of the box. You usually don't need to touch this file unless you're adding framework integrations (React, Vue, Svelte) or custom build steps.
How it all fits together
Here's the full picture from source to browser:
During development (npm run dev), Vite serves files directly — no dist/ folder needed. The browser connects to the local server and updates live as you edit.
Mapping the web stack to Unity/Blender
Visual Studio Code
Unity Editor
Blender
Where you write code
TypeScript (.ts)
C# scripts
Python scripts
Component logic
npm
Package Manager
—
Dependency management
package.json
Packages/manifest.json
—
Lists dependencies
node_modules/
Library/
—
Downloaded packages (don't commit)
npm run build → dist/
Build → Build/
—
Deployable output
npm run dev
Play Mode
—
Local preview with live reload
Checklist: what you should now understand
Next steps
Project Structure — every file and folder explained
TypeScript Essentials — learn the language
For Unity Developers — Unity-to-web transition guide
Create Components — start writing your own scripts
Last updated