The Problem
Designers need a browser‑based CAD tool that runs without installing heavy native binaries. Existing web CAD solutions either require server‑side rendering or expose a limited set of primitives, forcing users to switch to desktop applications for anything beyond basic sketches.
What This Does
chili3d delivers a full‑featured 3D CAD UI that runs entirely in the browser. Core geometry is powered by OpenCascade compiled to WebAssembly (packages/wasm/lib/chili-wasm.d.ts), while rendering and interaction use Three.js (packages/three/src/threeView.ts).
The TypeScript monorepo is split into logical packages:
packages/app– command definitions, UI bodies, and the top‑level command dispatcher.packages/core– foundational services (observer, pub/sub, math, i18n) and the document model.packages/builder– utilities for assembling the final bundle.
Key UI commands (e.g., packages/app/src/commands/create/box.ts, .../boolean.ts) map directly to the underlying shape primitives in packages/core/src/shape.
How It Is Wired
Execution begins in the CLI‑style command execute defined in packages/app/src/commands/application/newDocument.ts (line 14). That function instantiates a fresh document (packages/core/src/document.ts) and walks 290 internal functions, establishing the initial model graph.
The most frequently traversed backbone is the foundation hub:
packages/core/src/foundation/observer.ts– definesgetPrivateValue,setPrivateValue,initializeDefaultValue. Called from 58 files, it propagates state changes to the UI.packages/core/src/foundation/pubsub.ts– implementspub,sub,dispose. Reached by 50 files and used by the undo/redo stack.
A dense import cycle surrounds the core index modules (packages/core/src/foundation/index.ts, packages/core/src/math/index.ts, packages/core/src/document.ts). The cycle inflates the blast radius: any change to a shared type forces recompilation of >50 dependents and risks hidden runtime order bugs.
The call graph shows a few high‑impact functions:
getPrivateValue– called from 99 locations, central to every model mutation.setProperty– 83 callers, used by UI bindings and command handlers.gc– 54 callers, part of the custom memory manager for WebAssembly objects.
File‑level responsibilities that dominate runtime:
- Observer (
observer.ts) – state change detection, used by UI components and command services. - Pub/Sub (
pubsub.ts) – event distribution for undo/redo, selection, and viewport updates. - Matrix4 (
matrix4.ts) – geometric transforms, accessed by 41 files for every move/rotate operation.
No external I/O beyond two filesystem writes: execute → commit → delete (via this.open) and a read in get (also via this.open). No network calls are present in the static analysis.
How To Use It
# Clone the exact repo
git clone https://github.com/moses-y/chili3d
cd chili3d
# Install Node dependencies (lockfile present)
npm ci
# Build the WebAssembly module
npm run setup:wasm # installs emscripten toolchain if needed
npm run build:wasm
# Start development server
npm run dev # serves at http://localhost:8080
The Dockerfile (Dockerfile) can be used for production builds:
docker build -t chili3d .
docker run -p 8080:80 chili3d
No additional environment variables are required; configuration lives in packages/core/src/config.ts.
Real‑World Use
A manufacturing portal can embed the app by loading index.html from cpp/test/. The portal creates a new document via the exposed execute entry, runs a series of create commands (create/box.ts, create/boolean.ts) to generate a part, then calls saveDocument to export a STEP file. All steps run client‑side, eliminating server‑side CAD licensing.
Code Health & Issues
- MEDIUM – GITHUB_TOKEN permissions not limited (
.github/workflows/main.yml). - MEDIUM – No Dependabot/Renovate configured (
14 manifest files). - MEDIUM – CI runs
npm installinstead ofnpm ci. - MEDIUM – Docker base images are unpinned (
node:alpine,nginx:alpine). - MEDIUM – No dependency‑vulnerability scan in CI.
- MEDIUM – Large binary (
packages/wasm/lib/chili-wasm.wasm, 15 MB) stored in Git. - MEDIUM – Checkout step keeps credentials (
persist-credentialsdefault). - LOW – No job timeout set in workflow.
- LOW – Missing convention files (
.editorconfig, formatter config).
Static analysis also reported 45 import‑cycle members and 12 hub modules (e.g., packages/core/src/foundation/index.ts). These increase maintenance cost: any change to a hub may trigger widespread recompilation and risk subtle circular‑dependency bugs.
The Bottom Line
chili3d provides a functional, browser‑only CAD stack with a solid TypeScript foundation and WebAssembly‑accelerated geometry. It is suitable for teams that need an extensible web CAD surface and are comfortable managing import cycles and the current lack of automated security tooling. Expect to allocate effort to refactor core hubs and introduce CI hardening before using it in a production pipeline.