Prereqs
- Node.js or Bun
- Install the tscircuit CLI (global install):
- npm:
npm install -g tscircuit - bun:
bun install --global tscircuit
- npm:
Core commands
- Create / bootstrap a project
tsci init(interactive)tsci init -y(accept defaults)
Typical output includes:
index.tsx(main circuit entrypoint)package.json,tsconfig.jsontscircuit.config.json
- Preview locally (interactive)
tsci dev- Opens a local preview server (commonly https://localhost:3020)
- Note: For AI-driven iteration, prefer
tsci buildovertsci dev—dev mode is primarily for interactive visual feedback.
- Search the ecosystem
tsci search "<query>"- Finds footprints, components, and packages across multiple sources
Search flags:
--jlcpcb(or--lcsc) – Search JLCPCB/LCSC components by name or part number--kicad– Search KiCad footprint library--tscircuit– Search tscircuit registry packages
Examples:
# Search JLCPCB for microcontrollers
tsci search --jlcpcb "ATmega328"
# Output: ATMEGA328P-AU (C14877) - stock: 20,226
# Search JLCPCB by part number
tsci search --jlcpcb "C14877"
# Search for USB-C connectors on JLCPCB
tsci search --jlcpcb "USB-C 16pin"
# Search KiCad footprints
tsci search --kicad "QFP-32"
# Output: kicad:Package_QFP/LQFP-32_5x5mm_P0.5mm
# Search KiCad for SMD resistor footprints
tsci search --kicad "0402"
# Search tscircuit registry for existing projects
tsci search --tscircuit "LED"
# Output: seveibar/usb-c-flashlight - Stars: 5
# Search without flags (searches all sources)
tsci search "ESP32"- Add existing registry packages to your project
tsci add <author/pkg>- Use when a reusable tscircuit package already exists in the registry
- Example:
tsci add seveibar/PICO_W - Imports look like:
import { PICO_W } from "@tsci/seveibar.PICO_W" - The
@tsci/scope with dot notation (author.pkg) is the registry convention
- Import components (e.g., from JLCPCB)
tsci import <query>- Use when you need to bring a specific part into your project
- Searches both the tscircuit registry and JLCPCB parts database
- Opens an interactive picker to select and import the component
Workflow:
# First, search to find the part number
tsci search --jlcpcb "ATmega328"
# Output: ATMEGA328P-AU (C14877) - stock: 20,226
# Then import using the part number or name
tsci import "C14877"
# or
tsci import "ATmega328"The interactive picker shows:
- Registry packages (already wrapped by other users):
author/PART_NAME - JLCPCB parts (raw import):
[jlcpcb] PART_NAME (CXXXXXX)
Tip: If someone has already imported the part, prefer the registry version—it may have better pin mappings or schematic symbols.
- Build (generate circuit.json)
Before building, it can be a good idea to check placement of the entire board or a specific component with tsci check placement [file] [refdes]
tsci build(auto-detects entrypoint)tsci build path/to/file.circuit.tsx
Notes
- If no path is provided,
tsci buildsearches forindex.tsxormainEntrypointintscircuit.config.json. *.circuit.tsxfiles are built automatically.- Outputs go to
dist/.
Useful flags
--ignore-errors(CI/automation)--ignore-warnings--all-images(emit PCB/schematic/3D renders intodist/)
DRC (Design Rule Check)
- DRC errors are often reported but can frequently be ignored during development.
- Focus on getting the circuit correct first; DRC violations can be addressed later when preparing for manufacturing.
- Export (SVG/netlist/3D/library)
tsci export <file> -f <format>
Common formats
schematic-svgpcb-svgreadable-netlistspecctra-dsngltf/glbkicad-library
- Visual snapshots for analysis and verification
tsci snapshotgenerates visual outputs (schematic/PCB, optionally 3D) and writes/overwrites snapshots by default.- Use these visuals to inspect placement, orientation, and overall circuit understanding during iteration.
tsci snapshot --testswitches to regression-test mode: it fails on visual diffs and does not overwrite snapshots.tsci snapshot --pcb-onlygenerates only PCB visuals, which is especially useful for placement-focused iteration.tsci snapshot --3dincludes 3D snapshots in the output.
Recommended pattern:
# During development: generate fresh visuals for analysis and review
tsci snapshot
# During placement-heavy iterations: focus only on PCB output
tsci snapshot --pcb-only
# In CI/regression checks: detect unexpected visual changes without overwriting
tsci snapshot --test- Auth / publish
tsci login(browser-based)tsci push(publish package)tsci auth print-token
Guidance
- Prefer
tsci --helpandtsci <cmd> --helpwhen unsure about flags. - Avoid
tsci pushunless the user explicitly asks to publish.