Skip to the content
2 layers40 × 20 mmSample, the printed circuit board in 3D

WASM implementation of kicad native tools and IO (ERC,DRC,STEP,DSN,SES)

Size
40 × 20 mm
Copper layers
2
Thickness
1.6 mm
Parts
2
Nets
3
Pads
4
Tracks, vias
1, 0
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
11 Mar 2026
Updated
12 Jun 2026

Overview

Sample is an open-source printed circuit board by FixturFab, from the FixturFab/kicad-utilities-wasm repository on GitHub. It is a 2-layer board of 40 × 20 mm with 2 parts on 3 nets, routed with 1 track and 0 vias.

README

README.md

KiCad WASM Utilities

KiCad PCB and schematic tools running in the browser or Node.js via WebAssembly.

This project compiles KiCad's validation and export tools to WebAssembly, enabling PCB/schematic design checks and 3D export without a native KiCad installation.

Try the Live Demo

Features

DRC (Design Rule Check)

  • 26 DRC test providers — clearance, track width, hole size, annular width, silk/mask, courtyard, connectivity, and more
  • JSON output following the schemas.kicad.org/drc.v1.json schema

ERC (Electrical Rules Check)

  • 42 ERC violation types — pin conflicts, power integrity, unconnected nets, hierarchical sheet validation
  • JSON output following the schemas.kicad.org/erc.v1.json schema

STEP Export

  • 3D STEP model generation from PCB layouts using OCCT
  • Board geometry extraction — stackup, drill holes, component positions
  • Silkscreen engraving — engrave_depth_mm boolean-subtracts the silkscreen from the board body as real recesses (for laser-engraved panel previews); the removed volumes are kept as marker-colored ENGRAVING products

Specctra DSN/SES

  • DSN export for autorouter integration
  • SES import to apply routed tracks back to PCB

Common

  • Multi-threaded via WebAssembly pthreads (SharedArrayBuffer)
  • ~7 MB optimized WASM binary (-O3 -flto)
  • Runs in Node.js and browser environments

Quick Start

js
import { readFileSync } from 'fs';
import createKicadDRC from './build-wasm/kicad_drc.mjs';

// Initialize the WASM module
const Module = await createKicadDRC();

// Read a .kicad_pcb file
const pcb = readFileSync('board.kicad_pcb', 'utf-8');

// Allocate string in WASM memory
const len = Module.lengthBytesUTF8(pcb) + 1;
const ptr = Module._malloc(len);
Module.stringToUTF8(pcb, ptr, len);

// Load PCB (returns 0 on success)
const rc = Module._kicad_load_pcb(ptr, 0);
Module._free(ptr);

// Run DRC
const violationCount = Module._kicad_run_drc();

// Get JSON results
const jsonPtr = Module._kicad_get_drc_results();
const results = JSON.parse(Module.UTF8ToString(jsonPtr));

Run with threading support:

bash
node --experimental-wasm-threads test/test-wasm.mjs board.kicad_pcb

API Reference

The module exports four C functions, callable via Module._<name>():

kicad_load_pcb(pcb_content, length)

Load a KiCad PCB from in-memory content (s-expression format).

  • pcb_content (const char*) — null-terminated .kicad_pcb file content
  • length (size_t) — byte length, or 0 to use strlen
  • Returns 0 on success, non-zero error code on failure

kicad_run_drc()

Run all DRC checks on the loaded PCB. Must call kicad_load_pcb() first.

  • Returns number of violations found, or -1 on error

kicad_get_drc_results()

Get DRC results as a JSON string. The returned pointer is valid until the next call to kicad_run_drc() or kicad_cleanup().

  • Returns JSON string following the schemas.kicad.org/drc.v1.json schema, or NULL on error

kicad_cleanup()

Free all resources (board, DRC engine, results).

Output Format

Results follow the KiCad DRC JSON schema:

json
{
  "source": "board.kicad_pcb",
  "coordinate_units": "mm",
  "violations": [
    {
      "type": "silk_overlap",
      "severity": "warning",
      "description": "Silkscreen overlap ...",
      "items": [
        {
          "description": "Text \"REF**\" on F.Silkscreen",
          "pos": { "x": 100.0, "y": 50.0 }
        }
      ]
    }
  ],
  "unconnected_items": [],
  "schematic_parity": []
}

Building from Source

Prerequisites

  • Emscripten SDK (emsdk 5.0.0+)
  • CMake 3.20+
  • KiCad source tree with a completed native release build (provides generated headers)

Steps

bash
# 1. Clone KiCad source — NOTE: master pinned near 2026-03-06, NOT the 9.0
#    stable branch (the port tracks master-only files like layer_utils.cpp)
git clone --shallow-since=2026-02-15 https://gitlab.com/kicad/code/kicad.git kicad-src
git -C kicad-src checkout $(git -C kicad-src rev-list -1 --before="2026-03-07" origin/master)

# 2. Build KiCad natively first (needed for generated headers).
#    KICAD_USE_CMAKE_FINDPROTOBUF works around Ubuntu's protobuf packages
#    lacking CMake config files.
cmake -S kicad-src -B kicad-src/build/release -DCMAKE_BUILD_TYPE=Release \
      -DKICAD_USE_CMAKE_FINDPROTOBUF=ON -DKICAD_BUILD_QA_TESTS=OFF \
      -DKICAD_SCRIPTING_WXPYTHON=OFF
cmake --build kicad-src/build/release -j$(nproc)

# 3. Install and activate Emscripten
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk && ./emsdk install 5.0.0 && ./emsdk activate 5.0.0
source emsdk_env.sh && cd ..

# 4. Download OCCT 7.6.3 source (compiled into the WASM build for STEP export)
git clone --depth 1 --branch V7_6_3 https://github.com/Open-Cascade-SAS/OCCT.git \
    kicad-drc-wasm/thirdparty/occt-7.6.3

# 5. Configure WASM build (build-wasm-erc is the directory the node tests use)
emcmake cmake -S kicad-drc-wasm -B kicad-drc-wasm/build-wasm-erc

Output files:

  • kicad-drc-wasm/build-wasm/kicad_drc.wasm (7.3 MB)
  • kicad-drc-wasm/build-wasm/kicad_drc.mjs (103 KB loader)
  • kicad-drc-wasm/build-wasm/kicad_drc.worker.mjs (pthread worker)

Known Limitations

  • Violation count differs from kicad-cli — the WASM build reports 4 violations on the sample PCB vs. 6 from kicad-cli. The 2 missing are library parity warnings that require footprint library access and schematic data, which are not available in standalone mode.
  • No schematic parity checks — schematic data (testFootprints=false) is not loaded, so footprint-vs-schematic checks are skipped.
  • No library parity provider — drc_test_provider_library_parity is excluded (crashes in WASM static initialization due to a global UNITS_PROVIDER).
  • wxWidgets stubbed — wxString and other wx types are minimal stubs; no GUI functionality is available.
  • Threading requires SharedArrayBuffer — the browser must serve pages with Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp headers.

License

This project builds upon KiCad source code, which is licensed under the GNU General Public License v3.0. See the KiCad project for details.

Parts

2
QtyValueFootprintReferences
110kResistor_SMD:R_0805_2012MetricR1
14.7kResistor_SMD:R_0805_2012MetricR2

More from FixturFab/kicad-utilities-wasm

5
  • 2 layers50 × 35 mmParity test, the printed circuit board in 3D

    Parity test

    FixturFab/kicad-utilities-wasm

    WASM implementation of kicad native tools and IO (ERC,DRC,STEP,DSN,SES)

    3 parts2
  • 2 layers21 × 44 mmDrc config test, the printed circuit board in 3D

    Drc config test

    FixturFab/kicad-utilities-wasm

    WASM implementation of kicad native tools and IO (ERC,DRC,STEP,DSN,SES)

    2 parts2
  • 2 layers20 × 44 mmNetclass test, the printed circuit board in 3D

    Netclass test

    FixturFab/kicad-utilities-wasm

    WASM implementation of kicad native tools and IO (ERC,DRC,STEP,DSN,SES)

    2 parts2
  • 2 layers20 × 15 mmModel test, the printed circuit board in 3D

    Model test

    FixturFab/kicad-utilities-wasm

    WASM implementation of kicad native tools and IO (ERC,DRC,STEP,DSN,SES)

    2 parts2
  • 2 layers40 × 20 mmSamples, the printed circuit board in 3D

    Samples

    FixturFab/kicad-utilities-wasm

    WASM implementation of kicad native tools and IO (ERC,DRC,STEP,DSN,SES)

    2 parts2

Similar boards

  • 2 layers37 × 19 mmPassive rpi hub75-adapter, the printed circuit board in 3D

    Passive rpi hub75-adapter

    hzeller/rpi-rgb-led-matrix

    Controlling up to three chains of 64x64, 32x32, 16x32 or similar RGB LED displays using Raspberry Pi GPIO

    2 parts4.4kGPL-2.0
  • 2 layersDiode template, the printed circuit board in 3D

    Diode template

    adamws/kicad-kbplacer

    KiCad plugin for automatic keyboard's key placement and routing

    2 parts547GPL-3.0
  • 2 layers20.3 × 15.2 mmL0 button, the printed circuit board in 3D

    L0 button

    Luos-io/luos_engine

    Open-source and real-time orchestrator for cyber-physical-systems, to easily design, test and deploy embedded applications and digital twins.

    2 parts546MIT
  • 2 layers35.1 × 46.8 mmSDEX2M2 Breakout Board, the printed circuit board in 3D

    SDEX2M2 Breakout Board

    NVNTLabs/switch2-SDEX2M2

    Micro SD Express to M.2 NVME Adapter for Nintendo Switch 2

    2 parts542GPL-3.0
  • 2 layers59.3 × 36.6 mmExpansionBoardTemplate, the printed circuit board in 3D

    ExpansionBoardTemplate

    BlueSCSI/BlueSCSI-v2

    BlueSCSI v2/Ultra - an open source, open hardware, SCSI emulator using the Pi Pico PR2040 and Pico 2 RP2350

    2 parts459GPL-3.0
  • 2 layersAlpha.9mm.wire, the printed circuit board in 3D

    Alpha.9mm.wire

    ohmtech-rdi/eurorack-blocks

    Software to Hardware Prototyping for Eurorack using C++, Max/Gen~ or Faust

    2 parts410
  • 2 layers26.7 × 64 mmGpu power, the printed circuit board in 3D

    Gpu power

    dennisss/dacha

    Monorepo for awesome tools/projects/libraries

    2 parts397Apache-2.0

Questions

How big is the Sample PCB?

It measures 40 × 20 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Sample use?

2 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Sample KiCad files?

From the FixturFab/kicad-utilities-wasm repository on GitHub, at the commit this page was made from: the board is public/sample.kicad_pcb and its schematic public/sample.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Sample design in my own project?

Its repository states no licence, so its author keeps all rights: ask FixturFab before reusing the design.