Sim4D is a web-first, node-based parametric CAD system built on exact B-Rep/NURBS geometry. It leverages WebAssembly for high-performance geometry operations while maintaining a modern, responsive web interface.
- Web-First: Full browser-based CAD without plugins or native applications
- Node-Based: Visual programming paradigm for parametric modeling
- Exact Geometry: B-Rep/NURBS kernel via OpenCASCADE Technology (OCCT)
- Performance: WebAssembly + Web Workers for CPU-intensive operations
- Reactive: Real-time evaluation with intelligent caching and dirty propagation
┌─────────────────────────────────────────────┐
│ Sim4D Studio (React) │
├─────────────────────────────────────────────┤
│ • ReactFlow (Node Editor) │
│ • Three.js (3D Viewport) │
│ • Zustand (State Management) │
│ • Inspector (Parameter Editing) │
└─────────────────────────────────────────────┘
┌─────────────────────────────────────────────┐
│ Graph Management Layer │
├─────────────────────────────────────────────┤
│ • GraphManager (CRUD Operations) │
│ • DAGEngine (Evaluation & Caching) │
│ • NodeRegistry (Plugin System) │
│ • ComputeCache (Hash-based Caching) │
└─────────────────────────────────────────────┘
┌─────────────────────────────────────────────┐
│ Geometry Engine (OCCT.wasm) │
├─────────────────────────────────────────────┤
│ • Production OCCT WASM (55MB binaries) │
│ • 25 OCCT operations verified │
│ • Web Worker Isolation │
│ • Handle-based Geometry Management │
│ • Tessellation for Rendering │
│ • ✅ Real B-Rep/NURBS geometry │
└─────────────────────────────────────────────┘
OCCT WASM Status (November 14, 2025):
- ✅ All WASM binaries compiled and functional
- ✅ Standalone tests passing (makeBox, makeSphere verified)
- ✅ Shape ID generation working (deterministic)
- ✅ Bounding box calculations accurate
- ✅ Production-ready for Studio and CLI
graph TD
A[User Input] --> B[React UI]
B --> C[Graph Store/Zustand]
C --> D[GraphManager]
D --> E[DAGEngine]
E --> F[Node Evaluation]
F --> G[Worker Client]
G --> H[Web Worker]
H --> I[OCCT.wasm]
I --> J[Geometry Result]
J --> K[Tessellation]
K --> L[Three.js Viewport]
E --> M[ComputeCache]
M --> E
sim4d/
├── apps/
│ └── studio/ # Main web application
├── packages/
│ ├── engine-core/ # DAG evaluation engine
│ ├── engine-occt/ # OCCT WebAssembly bindings
│ ├── nodes-core/ # Geometry node definitions
│ ├── types/ # Shared TypeScript types
│ ├── schemas/ # JSON schemas
│ ├── viewport/ # 3D rendering component
│ ├── cli/ # Command-line interface
│ └── examples/ # Example graphs
@sim4d/studio
├── @sim4d/engine-core
├── @sim4d/engine-occt
├── @sim4d/nodes-core
├── @sim4d/viewport
└── @sim4d/types
@sim4d/engine-core
└── @sim4d/types
@sim4d/engine-occt
└── @sim4d/types
@sim4d/nodes-core
├── @sim4d/types
└── @sim4d/engine-core
- Topological Sorting: Ensures correct evaluation order
- Dirty Propagation: Efficient re-evaluation of affected nodes
- Parallel Evaluation: Concurrent processing where possible
- Abort Controllers: Cancellable operations
- Hash-based Caching: Content-addressed cache with xxhash
- Plugin Architecture: Extensible node registration
- Type Safety: Full TypeScript typing for inputs/outputs
- Socket System: Typed connections between nodes
- Parameter Schemas: Runtime validation of node parameters
- Comlink Communication: Type-safe RPC between main thread and worker
- Handle Management: Reference-based geometry lifecycle
- Operation Queue: Serialized geometry operations
- OCCT WASM Backend: Production geometry engine (verified November 14, 2025)
- 55MB compiled binaries (occt.wasm, occt-core.wasm, occt-core.node.wasm)
- 25 verified OCCT operations
- Deterministic geometry calculations
- Real B-Rep/NURBS kernel
- Worker Isolation: Geometry operations in separate context
- Content Security Policy: Strict CSP headers
- Input Validation: Schema-based parameter validation
- Sandboxed Evaluation: No eval() or dynamic code execution
- Incremental Evaluation: Only re-compute dirty nodes
- Content-addressed Caching: Deterministic cache keys
- Web Workers: Non-blocking geometry operations
- Virtual Rendering: React Flow virtualization for large graphs
- Debounced Updates: 500ms debounce on parameter changes
- Chrome/Edge: 90+
- Firefox: 88+
- Safari: 15.4+
- WebAssembly
- Web Workers
- SharedArrayBuffer (with COOP/COEP headers)
- WebGL 2.0
- ES2022 JavaScript
pnpm install
pnpm run dev
# Runs on http://localhost:5173pnpm run build
# Outputs to apps/studio/distFROM node:20-alpine
# Multi-stage build with OCCT compilation
# Nginx serving with proper headers- Node Evaluation: <100ms for simple operations
- Boolean Operations: <1s for moderate complexity
- Tessellation: <500ms for standard models
- Graph Load: <3s for 100+ node graphs
- Memory Usage: <2GB for typical workflows
- Max Nodes: ~1000 per graph
- Max Edges: ~5000 per graph
- Max Geometry Handles: ~10000 active
- Max File Size: 100MB for STEP import
- Define node in
packages/nodes-core/src/ - Register with
NodeRegistry - Implement evaluation function
- Add to node palette in UI
- Extend
GeometryAPIin engine-occt - Add worker message types
- Implement in mock geometry
- Add OCCT implementation
- Extend React components in studio
- Add to Zustand store
- Update graph converter utilities
- Style with CSS modules
- Shared dependencies and types
- Atomic commits across packages
- Simplified versioning
- Better refactoring support
- Non-blocking UI during heavy operations
- Memory isolation for large models
- Parallel geometry processing
- Clean separation of concerns
- Type safety across complex system
- Better IDE support and refactoring
- Self-documenting code
- Reduced runtime errors
- Production-ready node editor
- Excellent performance with virtualization
- Extensive customization options
- Active community and support
- Collaborative Editing: WebRTC + CRDTs
- Cloud Rendering: Server-side OCCT for complex operations
- Plugin System: Dynamic node loading
- Version Control: Git-like branching for designs
- AI Integration: ML-assisted modeling
- Phase 1: Client-side only (current)
- Phase 2: Optional server acceleration
- Phase 3: Distributed geometry processing
- Phase 4: Cloud-native architecture
- README.md - Project overview and quick start
- SETUP.md - Development environment setup
- API.md - API documentation
- CONTRIBUTING.md - Contribution guidelines