Exact CAD geometry,
written in TypeScript.
A real B-Rep kernel in your browser via WASM. A type system that makes invalid geometry uncompilable. And a verification loop so AI agents author parts that are provably correct — not just plausible.
- v18 · Apache-2.0
- OpenCascade kernel
- STEP-accurate
- runs in the browser
B-Rep vs mesh
Exact boundaries, not triangle soup.
Shapes are real mathematical boundaries — faces, edges, and vertices — so booleans are precise, measurements are real numbers, and STEP exports drop cleanly into SolidWorks, Fusion, and FreeCAD. No tessellation error baked into your model.


Type safety
If it compiles, the geometry is valid.
Branded types, Result<T, E>, and phantom types encode topological invariants in the type system. A ClosedWire, an OrientedFace, a ValidSolid mean exactly what they say. Malformed geometry doesn't fail at runtime — it fails to compile.
const w = unwrap(wire([line(a, b), line(b, c), line(c, a)]));
const f = filledFace(w);
~
// TS2345: Argument of type 'Wire' is not assignable
// to parameter of type 'ClosedWire'. Property
// '[__closed]' is missing in type 'Wire'.
// prove it closed first — now it compiles
const ok = filledFace(unwrap(closedWire(w))); // ✓The verify loop
CAD an agent can prove.
The hard part of AI plus CAD isn't drawing a shape — it's knowing it's correct. brepjs answers twice: the type system rejects invalid geometry before it runs, and brepjs-cad runs the part on a real kernel and returns a deterministic report — validity, measured dimensions, multi-view snapshots, a STEP export. Ships as a Claude Code skill and a CLI.
$ /plugin install brepjs@brepjs # the skill
$ npm i -D brepjs-cad # the runtime
> /brepjs:cad a 1×1 gridfinity bin
› brainstorm → design → implement → verify
✓ valid Solid · vol 14 043.4 mm³ · 91 faces
✓ assertions 3/3 · wrote bin.stepok: true shape verified
- shapeType
- "Solid"
- checks.isValidSolid
- passed ✓
- measurements.volume
- 14043.4
- measurements.area
- 11659.6
- measurements.bounds
- 41.7 × 41.7 × 30.5
- topology
- 91 f · 192 e · 104 v
- topology.manifold
- true
- assertions.volume
- 14043.4 = 14043.4 ✓
iso
front
top
rightPoint your agent at a spec; get back a part you can manufacture.
Engine-agnostic
Two kernels. One API. One line to switch.
occt-wasm — OpenCascade compiled to WebAssembly, about 4.7 MB brotli, Web Worker–ready — ships today as the default. brepkit, a Rust kernel built for speed (≈1 MB brotli), is a drop-in replacement under active development. Your code doesn't change.
occt-wasm
OpenCascade · WebAssembly · ~4.7 MB brotli · Web Worker–ready
brepkit
Rust kernel · built for speed · ≈1 MB brotli · drop-in
Ecosystem
Native to the stack you already use.
ESM, top-level await init, a Three.js mesh adapter, structured errors, web-worker friendly. Drops into Vite, Next.js, and React Three Fiber. brepjs produces the geometry; you render it however you like.
- ESM
- top-level await
- Web Workers
- Vite
- Next.js
- R3F
import { box, mesh, toBufferGeometryData } from 'brepjs/quick';
import * as THREE from 'three';
const data = toBufferGeometryData(mesh(box(30, 20, 10)));
const geo = new THREE.BufferGeometry();
geo.setAttribute('position', new THREE.BufferAttribute(data.position, 3));
geo.setAttribute('normal', new THREE.BufferAttribute(data.normal, 3));
geo.setIndex(new THREE.BufferAttribute(data.index, 1));File formats
Round-trips with the tools you already own.
Import and export STEP, STL, IGES, glTF, DXF, 3MF, and OBJ, plus 2D DXF/SVG profiles and OCCT BREP. Move exact solids between brepjs, SolidWorks, Fusion, and FreeCAD over STEP without losing precision.
- STEPin · out
- IGESin · out
- STLin · out
- OBJin · out
- 3MFin · out
- glTF / GLBin · out
- DXFin · out
- BREPin · out
- SVGin · 2D
Scope & fit
Built for exact, manufacturable geometry.
Boundary representation is the language of mechanical CAD — exact solids to micron precision, and the native form of STEP, CNC, and inspection. That's brepjs's strength: precise booleans, fillets, chamfers, and shells; real volumes, areas, and clearances; watertight solids that move cleanly between SolidWorks, Fusion, and FreeCAD. From a single bracket to a full assembly — enclosures, fixtures, gridfinity bins, machined and molded parts. It's a programmatic library, not a GUI, and exact B-Rep isn't the tool for organic sculpting or dense lattices; knowing that is part of why it's dependable.
Born from a tool people actually use — brepjs grew out of the Gridfinity Layout Tool.
- v18
- Apache-2.0
- OpenCascade kernel
- STEP-accurate
- runs in the browser
Write your first solid.
Authoring with AI? Set up the brepjs-cad skill →