Noureddine RAMDI / Maker.js: programmatic 2D vector drawing as composable, version-controlled CNC models

Created Sat, 23 May 2026 20:41:14 +0000 Modified Sat, 23 May 2026 20:41:27 +0000

microsoft/maker.js

Maker.js sits at the intersection of computational geometry and physical manufacturing, offering a way to treat 2D CNC designs not just as static drawings but as programmable, composable JSON objects. This approach means your CNC and laser cutter models can be version-controlled, shared, and modified like software packages, which is a refreshing take in a space where CAD designs are often locked into proprietary formats or manual workflows.

what Maker.js does and how it works

At its core, Maker.js is a TypeScript library designed for programmatic 2D vector line drawing and shape modeling. It targets CNC and laser cutter output, representing drawings as plain JavaScript objects serialized into JSON. These drawings are built from primitive paths—lines, arcs, circles—that get composed into models and organized into layers.

This architecture separates the drawing into fundamental geometric elements (paths) and higher-level groupings (models), allowing intricate designs to be built by composing simpler parts. Models themselves are Node.js modules that can be required, modified, and combined programmatically, which means you can build a library of reusable CNC components managed through your usual package and version control systems.

The library supports advanced geometry operations such as boolean unions and intersections, dogbone fillets (a common CNC routing technique to fit internal corners), chain detection (to find continuous sequences of paths), path expansion, and automated layout patterns like grids, bricks, and honeycombs. This capability means you can automate complex design workflows that would otherwise require manual CAD work.

Maker.js also supports imports and exports across multiple formats: 2D CAD formats like DXF, SVG, and PDF, and 3D formats such as STL and Jscad. It can import SVG path data and OpenType fonts, enabling text-based designs and vector graphics integration. This flexibility makes it a practical tool for bridging the gap between programmatic design and manufacturing.

architectural and technical strengths

The standout architectural idea is treating models as composable Node.js modules, enabling CNC designs to be shared, version-controlled, and programmatically modified just like software code. This approach is somewhat unusual in the CAD/CAM ecosystem, which often relies on monolithic files or binary formats.

The codebase is TypeScript-based, which helps with maintainability and type safety, especially for complex geometric operations. The representation of drawings as plain JSON objects makes them easy to inspect, modify, and serialize, but it also means the size and complexity of models can grow quickly if not managed carefully.

Tradeoffs are clear: while programmatic design offers automation and reuse, it requires a different skill set compared to traditional CAD tools. Users have to be comfortable thinking about geometry in code and working with JSON models, which can have a learning curve. The library doesn’t aim to replace interactive CAD software but to complement it by enabling programmatic generation and manipulation.

Code quality appears solid from the documented API and examples. The design favors modularity and composability, which aligns well with modern JavaScript/TypeScript development practices. However, complex CNC projects may still require external tooling for final adjustments or specialized CAM workflows.

quick start with Maker.js

Try it now

Visit the Maker.js Playground, a sample app to edit and run JavaScript from your browser. Each of the demos also opens in the playground so you can explore and modify their code.

To use in a web browser

Download the browser-based version of Maker.js and upload it to your website:

<script src="https://maker.js.org/target/js/browser.maker.js" type="text/javascript"></script>

Note: You may also need additional libraries.

In your JavaScript, use the require function to get a reference:

var makerjs = require('makerjs');

To use via CDN

Add a script tag to your HTML:

<script src="https://cdn.jsdelivr.net/npm/makerjs@0/target/js/browser.maker.js"></script>

To work with Bezier Curves, also include Bezier.js by Pomax:

<script src="https://cdn.jsdelivr.net/npm/bezier-js@2/bezier.js"></script>

For fonts, include both Bezier.js and Opentype.js by Frederik De Bleser:

<script src="https://cdn.jsdelivr.net/npm/opentype.js@0/dist/opentype.js"></script>

In your JavaScript, use the require function:

var makerjs = require('makerjs');

To use in Node.js

Install Maker.js via npm:

npm install makerjs --save

Then require it in your JavaScript:

var makerjs = require('makerjs');

verdict

Maker.js is a practical, well-architected library for developers and makers who want to bring programming rigor to 2D CNC and laser cutter design workflows. Its composable JSON model approach integrates well with modern development practices like version control and modular code reuse.

That said, it demands comfort with programmatic geometry and JavaScript/TypeScript. It is not a replacement for interactive CAD tools but rather a complementary tool for automating and customizing CNC designs, especially when you want reproducibility and parametric control.

If your projects involve CNC or laser cutting and you find yourself repeating similar designs or needing precise programmatic control, Maker.js can be a solid addition to your toolkit. It shines when you want to treat CNC models as code artifacts that can evolve, be shared, and be tested alongside the rest of your software stack.

Limitations include the learning curve for non-programmers and the complexity that can arise in managing large JSON-based models. Also, deeply specialized CAM features will still require external tools. Still, Maker.js offers a unique, code-centric angle on 2D manufacturing workflows worth exploring for technically inclined makers and developers.


→ GitHub Repo: microsoft/maker.js ⭐ 1,996 · TypeScript