Architecture
Main boundaries in the viewer, runtime, and optional backend.
COREY has two supported operating modes.
Local-First Mode
Users choose an IFC file from disk. The browser reads the file, creates the That
Open runtime inside IfcViewport, and keeps review state in React and browser
storage. Model bytes do not leave the browser in this mode.
Self-Hosted Backend Mode
The backend stores model metadata in Postgres and model bytes in S3-compatible object storage. Server-backed models use stable model ids for drafts, rule templates, Excel compute, and IFC writeback.
Main Boundaries
src/app/page.tsx: app entry for the viewersrc/features/viewer/components/viewer-shell.tsx: top-level React state and workflow orchestrationsrc/features/viewer/components/ifc-viewport.tsx: That Open, WebGL, worker, WASM, and tool lifecycle boundarysrc/features/viewer/lib/model-source.ts: local and remote model-loading abstractionsrc/features/viewer/lib/ifc-data.ts: tree, selection, category, table, and formatting helperssrc/features/rules/*: validation clause UI, provider, worker, and shared evaluatorsrc/server/*: Prisma, S3, model, draft, and rule-template storessrc/app/api/*: supported self-hosted API routes
Design Rules
- Keep That Open and WebGL code client-only.
- Keep
IfcViewportas the imperative runtime boundary. - Keep ordinary React state in
ViewerShell. - Preserve the
ModelSourceabstraction for local and remote model sources. - Preserve the single-model assumption unless multi-model workflows are explicitly designed.