# thatopen/engine_components architecture

> Architecture diagram of the GitHub repository thatopen/engine_components, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thatopen/engine_components
- Repository: https://github.com/thatopen/engine_components

## Overview

##### Project Type and Purpose
- This is an open-source, monorepo tool library for building browser-based 3D BIM applications.
- It delivers two npm packages:
- @thatopen/components (core BIM components, platform-agnostic)
- @thatopen/components-front (browser-only extensions)
- It integrates heavily with Three.js, web-ifc (IFC parser), and the fragments 3D engine.

##### High-Level Architecture
- **External Dependencies**
- Three.js
- web-ifc (engine_web-ifc)
- fragments engine (engine_fragment)
- NPM Registry
- **Monorepo Packages**
- Core Package (@thatopen/components)
- Front Package (@thatopen/components-front)
- **Examples & Demos**
- examples/* HTML + JS assets folder
- index.html entry point
- **Dev & CI/CD**
- GitHub Actions workflows (publish, release)
- Yarn v3/Webpack/Vite build pipeline
- Jest tests

##### Core Package Breakdown
- **core** (renderers, scene, camera, world, components manager)
- **fragments** (fragment-level BIM tools: BoundingBoxer, Hider, Exploder, etc.)
- **ifc** (IFC utilities: IfcLoader, IfcFinder, IfcPropertiesManager, IfcRelationsIndexer, IfcJsonExporter)
- **measurement** (MeasurementUtils)
- **openbim** (BCFTopics, IDSSpecifications)
- **utils** (bbox, geometry, materials, uuid, event management)

##### Front Package Breakdown
- **civil** (CivilNavigator family)
- **core** (ClipEdges, Marker, PostproductionRenderer, ShadowDropper)
- **fragments** (Highlighter, IfcStreamer, Outliner, Plans, Sections)
- **measurement** (Angle/Area/Edge/Face/Length/VolumeMeasurement)
- **utils** (graphic-vertex-picker, typeless-libraries-handler)

##### Examples & Demos
- Assets folder holding pre-built bundles, streaming IFC resources.

##### Dev & CI/CD Layer
- Workflows: publish-npm, release-please.
- Tooling: Yarn v3 (workspaces), Vite build (vite.config.ts), Jest (jest.config.ts).

##### Architectural Patterns & Principles
- Monorepo with Yarn Workspaces (shared dev dependencies, atomic commits).
- Modular design: each feature lives in its own folder with index.ts + example.
- Separation of concerns: Core is environment-agnostic; Front extends Core for browser.
- Plugin-like components: Components manager dynamically registers modules.
- Use of builder/provider pattern: ConfigManager for centralized configuration.

## Diagram (Mermaid)

```mermaid
graph TD
  %% External Dependencies
  ThreeJS["Three.js"]:::external
  WebIfc["web-ifc\n(engine_web-ifc)"]:::external
  FragmentsEng["fragments engine\n(engine_fragment)"]:::external
  NPMRegistry["NPM Registry"]:::external

  %% Monorepo Packages
  subgraph "Monorepo Packages"
    %% Core Package
    subgraph "Core Package"
      CorePkg["Core Package\n@thatopen/components"]:::core
      CoreCore["core"]:::core
      CoreFragments["fragments"]:::core
      CoreIfc["ifc"]:::core
      CoreMeasurement["measurement"]:::core
      CoreOpenbim["openbim"]:::core
      CoreUtils["utils"]:::core
    end
    %% Front Package
    subgraph "Front Package"
      FrontPkg["Front Package\n@thatopen/components-front"]:::front
      FrontCivil["civil"]:::front
      FrontCoreExt["core"]:::front
      FrontFragmentsExt["fragments"]:::front
      FrontMeasurementExt["measurement"]:::front
      FrontUtils["utils"]:::front
    end
  end

  %% Examples & Demos
  subgraph "Examples & Demos"
    ViewerApp(["Viewer App"]):::examples
    EntryPoint["index.html"]:::examples
  end

  %% Dev & CI/CD
  subgraph "Dev & CI/CD"
    GitHubActions["GitHub Actions"]:::ci
    Publish["publish-npm.yml"]:::ci
    Release["release-please.yml"]:::ci
    Yarn["Yarn v3 Workspaces"]:::ci
    Vite["Vite Build"]:::ci
    Jest["Jest Tests"]:::ci
  end

  %% Dependencies
  CoreCore --> CoreUtils
  CoreFragments --> CoreCore
  CoreIfc --> CoreUtils

  FrontMeasurementExt --> CoreMeasurement
  FrontCoreExt --> CoreCore
  FrontFragmentsExt --> CoreFragments
  FrontCivil --> CoreCore
  FrontUtils --> CoreUtils

  ViewerApp --> FrontCoreExt
  FrontPkg --> CorePkg

  CoreCore --> ThreeJS
  CoreIfc --> WebIfc
  CoreFragments --> FragmentsEng

  GitHubActions --> Publish
  GitHubActions --> Release
  GitHubActions --> Yarn
  GitHubActions --> Vite
  GitHubActions --> Jest

  Yarn --> CorePkg
  Yarn --> FrontPkg

  %% Click Events
  click CorePkg "https://github.com/thatopen/engine_components/tree/main/packages/core"
  click CoreCore "https://github.com/thatopen/engine_components/tree/main/packages/core/src/core"
  click CoreFragments "https://github.com/thatopen/engine_components/tree/main/packages/core/src/fragments"
  click CoreIfc "https://github.com/thatopen/engine_components/tree/main/packages/core/src/ifc"
  click CoreMeasurement "https://github.com/thatopen/engine_components/tree/main/packages/core/src/measurement"
  click CoreOpenbim "https://github.com/thatopen/engine_components/tree/main/packages/core/src/openbim"
  click CoreUtils "https://github.com/thatopen/engine_components/tree/main/packages/core/src/utils"

  click FrontPkg "https://github.com/thatopen/engine_components/tree/main/packages/front"
  click FrontCivil "https://github.com/thatopen/engine_components/tree/main/packages/front/src/civil"
  click FrontCoreExt "https://github.com/thatopen/engine_components/tree/main/packages/front/src/core"
  click FrontFragmentsExt "https://github.com/thatopen/engine_components/tree/main/packages/front/src/fragments"
  click FrontMeasurementExt "https://github.com/thatopen/engine_components/tree/main/packages/front/src/measurement"
  click FrontUtils "https://github.com/thatopen/engine_components/tree/main/packages/front/src/utils"
  click FrontUtils "https://github.com/thatopen/engine_components/blob/main/packages/front/src/typeless-libraries-handler.ts"

  click ViewerApp "https://github.com/thatopen/engine_components/tree/main/examples/"
  click EntryPoint "https://github.com/thatopen/engine_components/blob/main/index.html"

  click Publish "https://github.com/thatopen/engine_components/blob/main/.github/workflows/publish-npm.yml"
  click Release "https://github.com/thatopen/engine_components/blob/main/.github/workflows/release-please.yml"

  click Yarn "https://github.com/thatopen/engine_components/blob/main/.yarnrc.yml"
  click Yarn "https://github.com/thatopen/engine_components/blob/main/package.json"

  click Vite "https://github.com/thatopen/engine_components/blob/main/vite.config.ts"
  click Vite "https://github.com/thatopen/engine_components/blob/main/packages/core/vite.config.ts"
  click Vite "https://github.com/thatopen/engine_components/blob/main/packages/front/vite.config.ts"

  click Jest "https://github.com/thatopen/engine_components/blob/main/jest.config.ts"

  %% Styles
  classDef core fill:#cce5ff,stroke:#004085;
  classDef front fill:#d4edda,stroke:#155724;
  classDef external fill:#e2e3e5,stroke:#6c757d;
  classDef examples fill:#fff3cd,stroke:#856404,shape:cylinder;
  classDef ci fill:#f5c6cb,stroke:#721c24,shape:hexagon;
```
