$ show xiangechen/chili3d
Chili3D is a web-based 3D CAD application for online model design and editing. It features a modular TypeScript architecture with core packages for foundations, application logic, UI, Three.js rendering, and WebAssembly bindings to OpenCASCADE for CAD operations. The system uses a command pattern with decorators for UI actions, a transaction system for undo/redo, and a plugin architecture for extensibility. Key capabilities include primitive shape creation, Boolean operations, extrusion/revolve/sweep/loft, snapping, measurement tools, document management with IndexedDB persistence, and import/export of STEP, IGES, STL, and BREP formats. The UI implements an Office-style ribbon interface with property panels and hierarchical scene tree. The application is actively maintained with recent commits and demonstrates strong engineering practices in its reactive primitives, plugin system, and serialization framework.
The LLM identified 6 files worth highlighting for reuse:
Self-contained transaction system implementing commit/rollback semantics using WeakMap for change tracking. Framework-agnostic and easily extractable for any application requiring undo/redo functionality. Demonstrates clean implementation of the transaction pattern with proper resource disposal.
Decorator-based command registration system that attaches metadata (key, icon, application scope) to command classes. Works with the central CommandStore for decoupled command execution. Shows skilled use of TypeScript decorators to reduce boilerplate while maintaining type safety.
Core reactive primitives including Observable, Binding, and PubSub implementations. Provides lazy initialization, deep observation, and disposable resources. Highly reusable as a standalone reactivity system for any TypeScript application.
Manifest-based plugin architecture defining contribution points for commands, ribbons, i18n, and services. Supports dynamic plugin loading via URL parameters or programmatic registration. Demonstrates a clean, extensible plugin contract that could be adapted to other applications.
Abstract factory for creating geometric primitives (box, sphere, cylinder, etc.) and performing operations like boolean, extrusion, and revolution. Designed for extension via plugins and isolated from UI/framework specifics. Shows strong encapsulation of shape creation logic.
Modular snapping system with state machine (idle, snapping, completed, cancelled) and handlers for point, length, angle, and object snaps. Input-agnostic design handling mouse, touch, and keyboard events. Highly reusable for any interactive 2D/3D application requiring precise input.