Skip to content
Back to search

brepjs

MarketplaceWorks with Claude CodeGitHub

Web CAD library with exact B-Rep geometry

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/andymai/brepjs with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/andymai/brepjs'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/andymai--brepjs/badge.svg)](/listings/andymai--brepjs)

HTML

<a href="/listings/andymai--brepjs"><img src="/api/listings/andymai--brepjs/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

npm install brepjs occt-wasm

Starting fresh? `npm create brepjs my-project` scaffolds a TypeScript app with the kernel and the declarative family layer preconfigured.

`brepjs/quick` handles WASM init automatically via top-level await (ESM only). Other options:

// Auto-detect kernel
import { init } from 'brepjs';
await init();

// Or manual setup
import { OcctKernel } from 'occt-wasm';
import { registerKernel, OcctWasmAdapter } from 'brepjs';
const kernel = await OcctKernel.init();
registerKernel('occt-wasm', OcctWasmAdapter.fromKernel(kernel));

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 11 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. {
  2. "name": "brepjs",
  3. "owner": { "name": "andymai" },
  4. "plugins": [
  5. {
  6. "name": "brepjs",
  7. "source": "./packages/brepjs-cad",
  8. "description": "Brainstorm, design, author, verify, and polish parametric brepjs CAD models"
  9. }
  10. ]
  11. }
README.md · README · 260 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <div align="center">
  2. # brepjs
  3. A CAD library that you install from npm. You write TypeScript, and it gives you exact solids (B-Rep).
  4. AI agents can use it to write parts and check them on OpenCascade.
  5. [![npm](https://img.shields.io/npm/v/brepjs)](https://www.npmjs.com/package/brepjs)
  6. [![CI](https://github.com/andymai/brepjs/actions/workflows/ci.yml/badge.svg)](https://github.com/andymai/brepjs/actions/workflows/ci.yml)
  7. [![Last release](https://img.shields.io/github/release-date/andymai/brepjs?label=last%20release)](https://github.com/andymai/brepjs/releases)
  8. [![Commit activity](https://img.shields.io/github/commit-activity/m/andymai/brepjs?label=commits%2Fmonth)](https://github.com/andymai/brepjs/commits/main)
  9. [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE)
  10. https://github.com/user-attachments/assets/66a9308e-b7bf-4407-8718-2949332c67fc
  11. **[▶ Run this engine in your browser](https://brepjs.dev/playground/examples/turbofan-engine)**
  12. <a href="https://brepjs.dev/playground/examples/robot-arm"><img src="https://raw.githubusercontent.com/andymai/brepjs/main/media/arm-reel-poster.webp" alt="A six-axis robot arm in cutaway. The solver gives six joint angles for a tool position." width="49%"></a>
  13. <a href="https://brepjs.dev/playground/examples/pocket-watch"><img src="https://raw.githubusercontent.com/andymai/brepjs/main/media/watch-reel-poster.webp" alt="A pocket watch with Roman numerals on a white dial. Its hands show 10:08." width="49%"></a>
  14. <a href="https://brepjs.dev/playground/examples/mars-rover"><img src="https://raw.githubusercontent.com/andymai/brepjs/main/media/rover-reel-poster.webp" alt="A six-wheel Mars rover in cutaway, with its camera mast up and its arm folded." width="49%"></a>
  15. <a href="https://brepjs.dev/playground/examples/server-chassis"><img src="https://raw.githubusercontent.com/andymai/brepjs/main/media/chassis-reel-poster.webp" alt="A 1U rack-mount server chassis. Its cover slides to the rear and shows the drive cage and the fans." width="49%"></a>
  16. <a href="https://brepjs.dev/playground/examples/office-building"><img src="https://raw.githubusercontent.com/andymai/brepjs/main/media/building-reel-poster.webp" alt="A steel-framed office building of seven storeys. The glass facade comes off from the top and shows the frame." width="49%"></a>
  17. The playground also has these models. A [six-axis robot arm](https://brepjs.dev/playground/examples/robot-arm) moves by a published Denavit-Hartenberg table, and a [pocket watch](https://brepjs.dev/playground/examples/pocket-watch) keeps time with the tooth counts of a real calibre. A [Mars rover](https://brepjs.dev/playground/examples/mars-rover) has a mass budget and a centre of mass that the kernel measures. A [server chassis](https://brepjs.dev/playground/examples/server-chassis) has sheet metal that unfolds to flat blanks and a DXF. An [office building](https://brepjs.dev/playground/examples/office-building) is a BIM model with an IFC export.
  18. </div>
  19. This jet engine is one TypeScript file: 237 lines of brepjs that build 1,897 solids. It is a 1:10 display model, not an engineered design. Boolean cuts open the casings, a change to one parameter rebuilds the engine in about half a second, and the result exports to STEP. A coding agent (Claude Code) wrote the file, and `brep verify` checked it.
  20. For a full agent session, [watch an agent design a Raspberry Pi 5 case](https://youtu.be/n8Cbg345NRI) from the official drawing.
  21. Parts are plain TypeScript files, and the checker is a CLI, so any coding agent can use them. These two commands work in an empty folder:
  22. ```sh
  23. npx -y -p brepjs-cad brep init bracket # writes a starter part
  24. npx -y -p brepjs-cad brep verify bracket/bracket.brep.ts # builds it on a real kernel and reports
  25. ```
  26. To use it in a project, run `npm i -D brepjs brepjs-cad occt-wasm`. Then run `npx brep verify part.brep.ts`. MCP clients and Claude Code have their own setup. See [Authoring CAD with AI](#authoring-cad-with-ai-brepjs-cad).
  27. An agent rebuilt the 46 parts in our example gallery from their descriptions, and all 46 passed `brep verify`. [How we measured it](https://brepjs.dev/agent/eval).
  28. ## Or write it yourself
  29. **[▶ Try the live playground](https://brepjs.dev/playground)** · **[Examples](https://brepjs.dev/examples/)** · **[Getting Started](./docs/getting-started.md)** · **[Cheat Sheet](./docs/cheat-sheet.md)** · **[Docs](https://brepjs.dev/)**
  30. Shapes are exact mathematical boundaries (not triangle meshes), so booleans are precise, measurements are real, and you can export to STEP. TypeScript types prove that the geometry is valid at compile time.
  31. ```typescript
  32. // Drill a hole, fillet the vertical edges, write a STEP file
  33. import { writeFile } from 'node:fs/promises';
  34. import { box, cut, cylinder, fillet, edgeFinder, exportSTEP, unwrap } from 'brepjs/quick';
  35. const b = box(30, 20, 10);
  36. const hole = cylinder(5, 15, { at: [15, 10, -2] });
  37. const drilled = unwrap(cut(b, hole));
  38. const edges = edgeFinder().inDirection('Z').findAll(drilled);
  39. const part = unwrap(fillet(drilled, edges, 1.5));
  40. const step = unwrap(exportSTEP(part));
  41. await writeFile('part.step', await step.text()); // the standard exchange format for CAD tools
  42. ```
  43. To see a part while you write it, use the [playground](https://brepjs.dev/playground). To read complete programs, see the [examples](https://brepjs.dev/examples/): each page has a picture, the full code, and a link that runs it.
  44. ## Why?
  45. brepjs came out of my work on [gridfinitylayouttool.com](https://gridfinitylayouttool.com). I needed parametric CAD in the browser. I am not a 3D modeler, but I know TypeScript. [OpenSCAD](https://openscad.org/) does code-first CAD well, but it is outside the JS ecosystem. [replicad](https://replicad.xyz/) proved that OpenCascade works in JS, but I often hit performance limits and had to fight its API.
  46. Neither one had the type safety that I wanted, so type safety is central to brepjs. It uses branded types, `Result<T,E>`, and phantom types that prove invariants at compile time. If the code compiles, the geometry is valid.
  47. brepjs is strongest at exact geometry that you can manufacture, from a single part to a full assembly. Examples are enclosures, brackets, fixtures, gridfinity bins, and machined and molded parts. It does precise booleans, fillets, chamfers, and shells, and it measures real volumes, areas, and clearances. Its solids are watertight and round-trip through STEP. brepjs is not for organic sculpts or dense lattices. For those, use field-based (implicit/voxel) modeling.
  48. ## Install
  49. ```bash
  50. npm install brepjs occt-wasm
  51. ```
  52. `brepjs` is the API. `occt-wasm` is the geometry kernel that does the math, and it is a separate package so that you can switch to a different kernel. brepjs needs Node.js 24 or later, or a current browser.
  53. To start a new project, run `npm create brepjs my-project`. It makes a TypeScript app with the kernel and the declarative family layer already set up.
  54. `brepjs/quick` initializes the WASM kernel for you with top-level await (ESM only). You can also initialize it in one of these two ways:
  55. ```typescript
  56. // Auto-detect kernel
  57. import { init } from 'brepjs';
  58. await init();
  59. // Or manual setup
  60. import { OcctKernel } from 'occt-wasm';
  61. import { registerKernel, OcctWasmAdapter } from 'brepjs';
  62. const kernel = await OcctKernel.init();
  63. registerKernel('occt-wasm', OcctWasmAdapter.fromKernel(kernel));
  64. ```
  65. ## Usage
  66. Start with the chapter guide:
  67. - **[Why brepjs](https://brepjs.dev/introduction/why-brepjs)**: what makes it different, and who it is for
  68. - **[Install & Initialize](https://brepjs.dev/getting-started/install)**: three init styles, bundler notes
  69. - **[Your First Solid](https://brepjs.dev/getting-started/first-solid)**: the canonical drill-fillet-export workflow
  70. - **[Cheat Sheet](https://brepjs.dev/getting-started/cheat-sheet)**: single-page reference
  71. - **[Core Concepts](https://brepjs.dev/concepts/brep-vs-mesh)**: B-Rep, topology, types, kernels, tolerance
  72. - **[Common Tasks](https://brepjs.dev/tasks/booleans)**: booleans, fillets, sketching, lofts, sweeps, finders, measurement, IO
  73. - **[Declarative Models](https://brepjs.dev/families/overview)**: React-like parametric components (brepjs-families), key-path identity, IFC export
  74. - **[Sheet Metal](https://brepjs.dev/sheet-metal/overview)**: fold a part from a base and flanges, then unfold it to a flat pattern and a DXF (brepjs-sheetmetal)
  75. - **[Mesh to Solid](https://brepjs.dev/mesh2solid/overview)**: turn an STL, OBJ, PLY or 3MF mesh into a solid and a STEP file (brepjs-mesh2solid), or [convert one in your browser](https://brepjs.dev/mesh-to-solid)
  76. - **[Three.js Integration](https://brepjs.dev/integration/threejs)**: how to mesh shapes and render them
  77. - **[Migration](https://brepjs.dev/migration/replicad)**: how to move from Replicad, OpenSCAD, or Three.js
  78. - **[Extending brepjs](https://brepjs.dev/extending/architecture)**: custom kernels, custom operations, architecture
  79. - **[Reference](https://brepjs.dev/reference/glossary)**: glossary, function lookup, error codes, ADRs
  80. - **[API Reference (TypeDoc)](https://andymai.github.io/brepjs/)**: searchable type-level reference
  81. The older single-page docs stay in [./docs/](./docs/). The chapter site is the canonical location for the docs.
  82. ### Architecture
  83. ```
  84. Layer 3 sketching/, text/, projection/ High-level API
  85. Layer 2 topology/, operations/, 2d/ ... Domain logic
  86. Layer 1 core/ Types, memory, errors
  87. Layer 0 kernel/, utils/ WASM bindings
  88. ```
  89. Imports flow downward only. CI enforces the boundaries.
  90. ## Scope
  91. By design, brepjs does not:
  92. - **Render or display geometry**: brepjs makes shape data. To render it, pass the mesh output to Three.js, Babylon.js, or raw WebGL. The separate [`brepjs-viewer`](https://www.npmjs.com/package/brepjs-viewer) package is a React and Three.js renderer for that mesh output.
  93. - **Support organic or sculpting workflows**: brepjs models exact mechanical solids (parts and assemblies). Freeform or organic sculpts and dense lattices are out of scope. Field-based (implicit/voxel) modeling covers them.
  94. - **Make 2D drawings**: 2D profiles are a step toward 3D solids. You can export a profile to DXF (`exportDXF`, `blueprintToDXF`) or to SVG path data (`toSVGPathD`), but brepjs has no dimensions, title blocks, or sheets.
  95. - **Run in server-side rendering (SSR)**: the kernel is WASM and loads asynchronously, so frameworks such as Next.js, Nuxt, and Remix need a client-only import. Node.js scripts and the `brep` CLI work.
  96. - **Provide a GUI**: brepjs is only a programmatic API. It has no visual editor, viewport, or file picker.
  97. ## Status
  98. [occt-wasm](https://github.com/andymai/occt-wasm) (OpenCascade compiled to WebAssembly) is the default kernel. [brepkit](https://github.com/andymai/brepkit), a kernel in Rust, is in beta. Because of the kernel abstraction layer, a one-line change switches brepjs to brepkit.
  99. CI runs the full test suite on brepkit too, in the `test-brepkit` job. [`tests/knownFailures/brepkit.json`](./tests/knownFailures/brepkit.json) lists each test that still fails on brepkit, with its brepkit issue. The job fails when a new test fails or when a listed test passes. See [benchmarks](./benchmarks/results/latest.md) for performance comparisons.
  100. ## Authoring CAD with AI (brepjs-cad)
  101. [`brepjs-cad`](https://www.npmjs.com/package/brepjs-cad) helps an AI agent (or you) write CAD in brepjs and **prove that it is correct** before handoff. An LLM cannot see geometry. So it writes a `.brep.ts` part, runs it on a real kernel, and reads a deterministic report. It does not guess from how the code reads.
  102. `brepjs-cad` has two parts that work together:
  103. - A **Claude Code skill**, which runs the authoring loop.
  104. - A **CLI** (`brep`), which checks the part: validity, measured dimensions, multi-view snapshots, and STEP export.
  105. Install both. Each part has its own install path:
  106. ```bash
  107. # 1. The skill - Claude Code plugin (delivered via this repo's marketplace)
  108. # In a Claude Code session:
  109. /plugin marketplace add andymai/brepjs
  110. /plugin install brepjs@brepjs
  111. # …or from a terminal, non-interactively:
  112. claude plugin marketplace add andymai/brepjs
  113. claude plugin install brepjs@brepjs
  114. # 2. The runtime - the CLI the skill drives
  115. npm i -D brepjs-cad
  116. ```
  117. After you install the skill, ask Claude for a part in plain English. You can also start the pipeline directly with `/brepjs:cad "a 40×20×10 mm bracket with two M4 holes"`.
  118. `brepjs-cad` bundles its own `brepjs` + `occt-wasm`, so it runs in an empty directory. In a brepjs project, it prefers your installed versions, so the parts that it checks match what you ship. A model is a module. Its default export is a function that returns a shape:
  119. ```typescript
  120. // bracket.brep.ts
  121. import { box } from 'brepjs';
  122. export const expected = { volume: 8000, tolerancePct: 1 }; // optional: assert intent
  123. export default () => box(40, 20, 10, { centered: true });
  124. ```
  125. ```bash
  126. npx -y -p brepjs-cad brep verify bracket.brep.ts --check --step bracket.step --json report.json
  127. ```
  128. A part can declare its parameters with `defineParams`. Then `--param` builds it at a different size, and `brep publish` writes a static page with one slider for each parameter and STEP, 3MF and STL downloads. A person opens that page with no install:
  129. ```typescript
  130. // plate.brep.ts
  131. import { box, defineParams } from 'brepjs';
  132. export const params = defineParams({
  133. width: { type: 'number', default: 40, min: 20, max: 120, unit: 'mm' },
  134. });
  135. export default (p = params.values) => box(p.width, 20, 10, { centered: true });
  136. ```
  137. ```bash
  138. npx -y -p brepjs-cad brep verify plate.brep.ts --param width=80
  139. npx -y -p brepjs-cad brep publish plate.brep.ts --out site
  140. ```
  141. See [Publish a Part as a Page](https://brepjs.dev/agent/publish).
  142. The command exits non-zero unless the report is `ok` (valid **and** every declared dimension within tolerance). Thus you can put it directly into CI or an agent loop. For agents that use MCP, the package also ships a stdio MCP server (`brep-mcp`). It gives the same build-and-check step as a `run_program` tool. See the [**Authoring with AI**](https://brepjs.dev/agent/overview) guide for the full loop, the CLI reference, the MCP server, examples, and the measurement eval.
  143. ## Declarative models and BIM (brepjs-families + brepjs-bim)
  144. [`brepjs-families`](https://www.npmjs.com/package/brepjs-families) is a React-like component layer over the CSG IR. Each parametric part is a component: props drive it, you can compose it, and zod checks its props. The IR is content-addressed, so identical subtrees materialize only once. [`brepjs-bim`](https://www.npmjs.com/package/brepjs-bim) projects the same tree to IFC4, with stable GlobalIds that come from the component key paths. The IFC output has walls, slabs, columns, beams, roofs, stairs, and real openings (`IfcOpeningElement` + `IfcRelFillsElement`).
  145. ```typescript
  146. const Wall = family('Wall', (p: WallProps) =>
  147. el('Box', { size: [p.length, p.thickness, p.height], voids: p.voids ?? [] })
  148. );
  149. const wall = Wall({ key: 'south', length: 4000, thickness: 200, height: 2700 });
  150. const tree = resolve(Storey({ key: 'ground', items: [wall] }));
  151. evaluateModel(tree, evaluator); // viewport meshes, one per key path
  152. familiesToBim(tree, { project }); // IFC via brepjs-bim
  153. ```
  154. ```bash
  155. npm create brepjs my-building # scaffold a project
  156. npx brepjs add room storey slab # copy in starter families (code you own)
  157. ```
  158. See the [**Declarative Models**](https://brepjs.dev/families/overview) guide.
  159. ## Projects Using brepjs
  160. - [Gridfinity Layout Tool](https://github.com/andymai/gridfinity-layout-tool): Web-based layout generator for Gridfinity storage systems
  161. - [layerling](https://github.com/henmedia/layerling): Free browser-based 3D CAD for 3D printing
  162. ## Get in touch
  163. I am Andy Aragon. I build and maintain brepjs and the geometry kernels below it ([occt-wasm](https://github.com/andymai/occt-wasm), [brepkit](https://github.com/andymai/brepkit)). Do you build something on brepjs and want help, or do you have a question? **[Get in touch →](https://brepjs.dev/support)**
  164. ## Contributing
  165. See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup and guidelines.
  166. ## Acknowledgements
  167. [Vercel](https://vercel.com) hosts brepjs.dev and the playground through its Open Source Program.
  168. <div align="center">
  169. <a href="https://vercel.com/open-source-program">
  170. <img alt="Vercel OSS Program" src="https://vercel.com/oss/program-badge-2026.svg" />
  171. </a>
  172. </div>
  173. ## License
  174. brepjs itself is [Apache-2.0](./LICENSE). The kernel that you register has its own license. A product that you ship must comply with the license of brepjs and the license of that kernel:
  175. | Package | License | What it means for your product |
  176. | ------------------------------ | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  177. | `brepjs` (this package) | Apache-2.0 | Use freely, open or proprietary |
  178. | `occt-wasm` kernel | LGPL-2.1-only (WASM output; tooling MIT OR Apache-2.0) | Proprietary use permitted under the LGPL's terms |
  179. | `brepkit-wasm` kernel (3.0.0+) | AGPL-3.0-only or commercial | Open-source products use it freely under the AGPL; proprietary products need a [commercial license](https://github.com/andymai/brepkit/blob/main/COMMERCIAL-LICENSE.md) from Collective Context, LLC |
  180. `brepkit-wasm` versions through 2.129.x have the MIT OR Apache-2.0 license, and they stay available under those terms.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.