How bitbybit-dev/bitbybit works
Main Components
• CAD Kernels/3D Algorithms: Represent the external or internal kernels such as JSCAD, Manifold, and OpenCascade.
• Rendering Engines: Represent BabylonJS and ThreeJS as separate integrated engines (or modules) that connect with the underlying geometry packages.
• Web Worker Layer: Highlight the worker packages that allow non-blocking asynchronous processing of geometry computations.
Relationships and Interactions
• That the “core” package aggregates functionality from various lower-level packages (such as “base” and the CAD kernel wrappers).
• “engine integrations” (BabylonJS and ThreeJS) as specialized layers – for example, the @bitbybit-dev/babylonjs and @bitbybit-dev/threejs packages have dependencies on the underlying CAD and core algorithms.
• Web worker packages with their corresponding main packages (for JSCAD, Manifold, and OCCT), indicating that calls to these libraries can be offloaded to the workers.
• That “base” provides foundational algorithms (like vector math) that feed into all upper-level components.
• From the core algorithm layer (and base) to the rendering engine layers.
• From the computational kernels to the worker wrappers that deliver asynchronous processing.
Architectural Patterns and Design Principles
• Separation of Concerns: The refactoring away from a BabylonJS-dependent UI to a game-engine–independent core illustrates decoupling.
• Worker Offloading: The existence of dedicated “-worker” modules indicates a design pattern for concurrency and non-blocking operations.
• API Wrapping: Several packages serve as wrappers to enrich existing libraries or to add extended algorithms – show the layering where higher-level API wrappers depend on the lower-level geometry kernel services.
Relevant Technologies and Frameworks
• That TypeScript is used for these packages (visible by the .ts files and tsconfig files) and that Babel is used as a build/bundling tool (babel.config.cjs files).