Skip to main content
Footprints can be copied as a reconstructed .kicad_mod, or the raw upstream file can be downloaded for full fidelity. The clipboard builder is in src/lib/clipboard.ts.

Clipboard reconstruction — buildFootprintKicadMod

import { buildFootprintKicadMod, copyFootprintForClipboard } from "@/lib/clipboard";

const sexp = buildFootprintKicadMod({ name, library, pads });   // minimal valid .kicad_mod
await copyFootprintForClipboard({ name, library, pads });        // writes to clipboard
It lays the pads out in a square grid (cols = ceil(sqrt(padCount)), 1.27 mm spacing, centered on origin), detects smd vs thru_hole from each pad’s type, and tags the generator trace_footprints. FootprintActions wires this to the “Copy to Clipboard” button.
Reconstruction is a quick, editable placeholder built from pad data — it does not reproduce real pad geometry, courtyard, silkscreen, or 3D model. For real geometry, use the raw download below.

Raw download — GET /api/download/[library]

Serves the raw original .kicad_mod from the upstream Trace GitHub repo, preserving all geometry and graphics.
name
string
required
Footprint name (without extension).
source
string
default:"trace"
trace or cern.
GET /api/download/Package_DFN_QFN?name=QFN-16-1EP_3x3mm_P0.5mm&source=trace
→ 200  Content-Type: application/octet-stream
       Content-Disposition: attachment; filename="QFN-16-1EP_3x3mm_P0.5mm.kicad_mod"
       Cache-Control: public, max-age=86400
Internally it fetches: https://raw.githubusercontent.com/buildwithtrace/trace-kicad-footprints-lib/main/{library}.pretty/{name}.kicad_mod (library + name are validated against a safe charset; no path traversal).
CERN footprints are not mirrored on the Trace GitHub repo. source=cern returns 404 (“Raw download unavailable for this source”), and the client falls back to clipboard reconstruction. 400 if name is missing.