Code as Schematic
Why Write Code Instead of Dragging Components?
Traditional electrical design tools force you to click, drag, and manually wire components in a GUI. typeCAD takes a different approach: write TypeScript code to describe your circuit, then build it into a KiCAD project.
The Coding Experience
๏ฟฝ Familiar Developer Tools
import { PCB } from "@typecad/typecad";
import { Resistor, Capacitor } from "@typecad/passives/0603";
let typecad = new PCB("my_circuit");
let r1 = new Resistor({ value: "10kohm" });
let c1 = new Capacitor({ value: "100nF" });
Use VS Code, TypeScript intellisense, and all your favorite developer tools. Get autocomplete for component properties, instant error checking, and refactoring support that actually understands your circuit.
๐ฏ Declarative Circuit Description
// Describe what you want, not how to draw it
typecad.net(mcu.VCC, r1.pin(1), c1.pin(1)); // Power rail
typecad.net(mcu.GND, r1.pin(2), c1.pin(2)); // Ground rail
typecad.net(mcu.ADC0, r1.pin(2)); // Sensor input
Focus on the electrical connections and component relationships, not pixel-perfect wire routing. The code describes the circuitโs behavior and intent clearly.
๐ Parametric and Calculated Values
// Let code do the math
function ledResistor(vcc: number, vf: number, current: number) {
return new Resistor({ value: `${(vcc - vf) / current}ohm` });
}
let r_led = ledResistor(5.0, 2.1, 0.02); // 145ฮฉ for 20mA LED
No more manual calculations or looking up resistor values. Define your requirements and let TypeScript calculate the exact component values you need.
Code vs. GUI Comparison
GUI Schematic Tools | typeCAD Code |
---|---|
๐ฑ๏ธ Click, drag, place components | โจ๏ธ new Resistor({ value: "1kohm" }) |
๐ Manually draw wires | ๐ typecad.net(pin1, pin2) |
๐ Eyeball component values | ๐งฎ Calculate exact values with code |
๐ Hunt through component libraries | ๐ฆ Import from npm packages |
๐ Manual component lists | ๐ Generated BOMs and docs |
The Developer Advantage
Writing hardware as code brings the same benefits that transformed software development:
- Readability: Circuit intent is clear from the code structure
- Maintainability: Easy to modify and extend existing designs
- Consistency: Standardized patterns across all your projects
- Speed: Express complex circuits in just a few lines
- Precision: Exact component values, no manual entry errors
Ready to design hardware like you write software?
On This Page