How red1oon/bim-ootb works
Purpose and Entry Points
BIM OOTB is a static, browser-native BIM + ERP platform: IFC/model data is queried, rendered, scheduled, costed, and linked to an event-sourced ERP without an application server. Primary entry points are the gallery/import landing page (index.html), launcher (index2.html), BIM viewer (viewer/viewer.html), DAGeVu BIM authoring surface (modeller/modeller.html), and ERP clients (erp/erp.html, erp/idempiere.html).
BIM Viewer Runtime
The viewer bootstraps a Three.js scene, camera, picking, panels, and navigation, then loads model/database-backed geometry. Core orchestration and rendering are in viewer/main.js, viewer/scene.js, and viewer/streaming.js. The viewer is primarily read-oriented: it turns BIM SQLite rows and IFC-derived assets into streamed meshes, selectable scene objects, and analysis/UI state.
Model Data and Import Boundary
BIM state is represented by SQLite model databases, including committed sample databases and SQL patch sets (modeller/Duplex_extracted.db, buildings/patches/Clinic_extracted.db.sql, viewer/schema_5table.sql). Remote building databases are range-read through HTTP VFS; imported IFC/mesh work occurs in workers and is persisted locally. The import boundary is viewer/import.js, viewer/import_worker.js, and viewer/import_db_builder.js; IFC parsing uses bundled web-ifc (viewer/lib/web-ifc.wasm).
BIM Analysis and Planning
The viewer derives BOM, quantities, costs, schedules, clashes, and construction playback from model data. BOM logic resides in viewer/bom_engine/bom_tree.js, viewer/bom_extract.js, and viewer/bom_walker.js. Scheduling is authored, computed, and synchronized through viewer/schedule_engine.js, viewer/schedule_author.js, and viewer/cpm_schedule.js. Cost/rate computation uses viewer/rates.js, country templates such as viewer/rates/rsmeans2024_us.json, and 4D/5D exports. Clash and coordination functions center on viewer/measure.js and viewer/mep_coordination.js.
DAGeVu Authoring
DAGeVu is a separate authoring surface that treats a signed operation log as the feature tree and deterministically folds operations into geometry. The UI/runtime entry is modeller/modeller.html; authoring kernel coordination is modeller/bonsai_kernel.js with worker execution in modeller/bonsai_kernel_worker.js. It uses OpenCascade WASM (modeller/lib/kernel/occt-wasm.wasm) and a Planegcs constraint solver (modeller/lib/planegcs/planegcs.wasm) for B-rep, sketch, grid, and component/assembly workflows.
Kernel-ERP
Kernel-ERP renders an Application Dictionary over SQLite WASM, but operational truth is replayed from signed events rather than mutable application records. The fold/runtime is erp/erp_kernel.js; verbs are defined in erp/kernel_ops.js; ledger signing is in erp/erp_signer.js. The AD UI renderer is erp/ad_ui.js, and rule/lifecycle validation is a data-driven fold in erp/rule_fold.js. ERP document processes are deterministic derivations in erp/ad_process.js. Exact monetary arithmetic relies on erp/bigdecimal.js.
Shared Op-Log and Cross-Surface Context
The principal integration boundary is the shared signed op-log: BIM edits, ERP facts, and reversible history are folded independently by their respective surfaces. Cross-surface selection, timeline, and identity propagation is implemented by viewer/connect_scene.js; common history primitives are in common/history_bar.js and common/whole_history.js. Teams extends this into branch/presence/replay collaboration via teams/engine.js, teams/protocol.js, and teams/transport.js.
Infrastructure and Delivery
This is vanilla JavaScript served as static files: no framework, build server, or required backend. GitHub Pages is deployed by .github/workflows/deploy-pages.yml; CI/release automation is under .github/workflows/ci.yml and .github/workflows/release-please.yml. OCI Object Storage hosts large building DBs externally. Offline operation is provided by service workers (viewer/sw.js, erp/sw.js), IndexedDB, Web Workers, and browser-native BroadcastChannel. Major browser/WASM dependencies include Three.js, sql.js/SQLite, HTTP VFS, web-ifc, OpenCascade, and Planegcs.
Main entry points: whole_history.js Signed op-log · deploy-pages.yml Static Pages delivery · main.js Scene runtime · viewer.html Viewer entry
Components 20
BIM Viewer
- Viewer entry
viewer/viewer.html - Scene runtime · Bootstraps rendering, picking, navigation, and panels.
viewer/main.js - Geometry streaming · Turns model rows into streamed selectable meshes.
viewer/streaming.js - BIM model databases · SQLite model state and schema patches.
modeller/Duplex_extracted.db - IFC import pipeline · Parses IFC or mesh imports and persists local model data.
viewer/import.js - BOM & planning · Derives quantities, costs, schedules, clashes, and playback.
viewer/bom_extract.js - Cross-surface context · Propagates selection, identity, and timeline context.
viewer/connect_scene.js
DAGeVu Authoring
- DAGeVu entry
modeller/modeller.html - Feature-tree kernel · Deterministically folds signed operations into geometry.
modeller/bonsai_kernel.js - Geometry kernel worker · Runs OpenCascade and constraint-solving workflows.
modeller/bonsai_kernel_worker.js
Kernel-ERP
- ERP client entry
erp/erp.html - ERP event fold · Replays signed facts as operational truth.
erp/erp_kernel.js - ERP verbs & rules · Defines operations and lifecycle validation.
erp/kernel_ops.js - Application Dictionary UI · Renders ERP application dictionary and deterministic processes.
erp/ad_ui.js
Shared History & Teams
- Signed op-log · Common reversible history for BIM edits and ERP facts.
common/whole_history.js - History controls
common/history_bar.js - Teams collaboration · Adds branching, presence, and replay.
teams/engine.js
Other components
- Gallery & import landing
index.html - Surface launcher
index2.html - Static Pages delivery · GitHub Pages serves browser-native clients and assets.
.github/workflows/deploy-pages.yml
Connections 24
- Gallery & import landing → Viewer entry: opens
- Surface launcher → Viewer entry: launches
- Surface launcher → DAGeVu entry: launches
- Surface launcher → ERP client entry: launches
- Viewer entry → Scene runtime: boots
- Scene runtime → Geometry streaming: loads meshes
- Geometry streaming → BIM model databases: reads rows
- IFC import pipeline → BIM model databases: persists imports
- Scene runtime → BOM & planning: drives analysis
- Scene runtime → Cross-surface context: publishes context
- DAGeVu entry → Feature-tree kernel: boots
- Feature-tree kernel → Geometry kernel worker: executes geometry
- Feature-tree kernel → Signed op-log: folds edits from
- ERP client entry → Application Dictionary UI: boots
- Application Dictionary UI → ERP event fold: renders folded state
- ERP event fold → ERP verbs & rules: applies verbs and rules
- ERP event fold → Signed op-log: replays facts from
- Cross-surface context → Signed op-log: uses history
- History controls → Signed op-log: navigates
- Teams collaboration → Signed op-log: branches and replays
- Static Pages delivery → Gallery & import landing: serves
- Static Pages delivery → Viewer entry: serves
- Static Pages delivery → DAGeVu entry: serves
- Static Pages delivery → ERP client entry: serves