Case study 02 // structural engineering // TypeScript

OpenStrut V2_

A free, offline-first web app for reinforced-concrete design of simple buildings: slabs, beams and columns, floor by floor. It runs in the browser with no server, under two design codes, and exports IFC4, DXF R12 and glTF.

  • TypeScript 7
  • React 19
  • Vite 8
  • Three.js
  • PWA
  • Bun 1.4.2
  • GPL-3.0-or-later

Official links

Plate 00 // Exploded view by normal force Nk. The (!) badges mark parts affected by a defect of the 1991 program.

01 // Stack

Language and runtime constellation

Counted on disk with os.walk, skipping .git, node_modules, dist and build. Select a node to read its role.

OpenStrut stack constellation: TypeScript at the hub, React TSX, WebGL and SVG CAD on the inner ring, IFC4 STEP, DXF R12, QuickBASIC and Python with Shell on the outer ring. OpenStrut stack constellation: TypeScript at the hub, React TSX, WebGL and SVG CAD on the inner ring, IFC4 STEP, DXF R12, QuickBASIC and Python with Shell on the outer ring.

01 // TypeScript // 412 files352 in src/. The structural engine for both codes, domain geometry, the 182-line IFC4 STEP writer, the DXF R12 exporter, the SISTRUT 1991 parser, 187 Vitest suites and 40 Playwright tests.

02 // Architecture

Software and structural architecture blueprint

Four stages, all in the browser: local-first input and importers, a pure calculation engine, detailing with code checks, and client-side outputs. No server sits on the path.

Fig. 01 // From plan to IFC in four stages. Select the diagram to enlarge it.

src/dominio/

Domain

The project model. It places beams on slab edges and columns at their crossings automatically.

src/calculo/

Engine

Pure TypeScript with no React import: normas/, lajes/, vigas/, pilares/, detalhamento/, fluxo.ts.

src/planta/ + obra3d/

Interface

The SVG plan editor and the Three.js viewer sit on top of the engine. The engine imports neither.

src/armazenamento/

Storage

.openstrut.json files, an IndexedDB draft through idb-keyval, Google Drive import and the SISTRUT 1991 importer.

03 // Engine

One pure TypeScript engine, two design codes

The engine implements two codes. NB-1/78 has two modes: one reproduces the 1991 program bit for bit, the other runs the same algorithms with its catalogued defects fixed. Select a mode to compare.

Comparison of the three calculation modes
PropertyNBR 6118:2023NB-1/78 corrigidoNB-1/78 original
UnitsSISI, 500 MPa steel, 25 kN/m³t, m, cm, t/cm²
ArithmeticFloat64Float64Float32 (SINGLE), rounded at every assignment
GoalDesign to the current codeLegacy algorithms with catalogued defects fixedMatch SISTRUT 4.0 number for number
Checked againstBastos (UNESP) worked examples, hand calculations, numerical integrationShares the algorithms checked in the original modeThe 1991 binary in DOSBox-X

NBR 6118:2023Current Brazilian code. Slabs by the Bares/Pinheiro elastic tables with Branson immediate deflection and long-term deflection; columns up to slenderness 140 with the M-N-1/r diagram and creep.

NBR 6118:2023 // slabs and beams

Slabs and beams

  • Solid slabs by the Bares/Pinheiro elastic tables.
  • Immediate deflection by Branson, plus long-term deflection.
  • Continuous beams with a live-load envelope, single and double reinforcement in bending, and shear.

NBR 6118:2023 // columns

Columns

  • Load accumulated floor by floor, with minimum moments.
  • Beam-column joint by item 14.6.6.1.
  • Second order by the standard-column method. For slender columns with 90 < λ ≤ 140, the standard column is coupled to the M-N-1/r diagram with creep.
  • Normal and oblique combined bending by the parabola-rectangle diagram.

src/calculo/detalhamento/

Full detailing

Good and poor bond zones, anchorage lengths lb and lb,nec, shift of the moment diagram, 90°, 135° and semicircular hooks, lap splices, ties and the steel schedule by bar diameter.

04 // Formats

A 25 KB IFC4 writer instead of a 1.6 MB WebAssembly binary

OpenStrut writes ISO 10303-21 STEP text directly. step.ts is 182 lines with no dependency, and the export chunk loads only when the user exports.

Bytes downloaded for IFC export

  • OpenStrut IFC4 chunk25.0 KB
  • Same chunk, gzip10.0 KB
  • web-ifc, .wasm file alone1,600 KB

Bars share one scale. The writer is 1/64 of the size of the web-ifc WebAssembly file.

  • Exports IfcColumn, IfcBeam, IfcSlab and IfcReinforcingBar, with bars as IfcSweptDiskSolid through IfcMappedItem.
  • Each element gets a deterministic 128-bit GlobalId, so BCF comments in BIMcollab stay attached when the model is exported again.
  • Roundtrip checked in IfcOpenShell, web-ifc and @ifc-lite/parser.
  • DXF R12 export of the formwork plan and of beam reinforcement.
  • Multi-file importer for SISTRUT 1991 projects: .LAJ, .VIG, .COL, .SEC, .FOR, .TAB, .EDV and more, in Windows-1252 with the ^Z end-of-file mark.

05 // Verification

Tests that never grade their own output

An expected value in OpenStrut never comes from the function under test. It comes from a source the code did not produce.

  • 187Vitest unit and UI test files
  • 40Playwright E2E files
# .github/workflows/ci.yml
bun run check
  tsr generate && tsc -b --noEmit
  && oxlint && oxfmt --check
  && vitest run
# then the Playwright E2E suite, which checks
# the printed PDF report with pdftotext
  1. 01Published worked examples by Prof. Paulo Bastos (UNESP): slabs E02 and E03, beams E04 to E10, columns E11 to E13.
  2. 02Hand calculations.
  3. 03Independent numerical integration.
  4. 04The SISTRUT 4.0 binary from 1991 running in DOSBox-X, for the original NB-1/78 mode.

06 // Interface

2D and 3D engineering plates

Captures of the live app. Pick a plate; select the large view to enlarge it.

Plate // 2D plan editor in NBR 6118:2023 mode. Roof floor of the two-storey example: 5 slabs, 7 beams, 11 columns, all green.

Engineering notice

A licensed engineer must check every result

OpenStrut results require review by the responsible structural engineer before any use. ABNT standards are paid documents, so the NBR 6118:2023 coefficients come from public university course notes cited in the code and in docs/norma/. Points not yet confirmed carry the marker [VERIFICAR].

OpenStrut is an independent rebuild of SISTRUT 4.0 by reverse engineering, with no link to the original authors.