# tscircuit/tscircuit architecture

> Architecture diagram of the GitHub repository tscircuit/tscircuit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tscircuit/tscircuit
- Repository: https://github.com/tscircuit/tscircuit

## Overview

This repository is the distributable tscircuit umbrella package: it re-exports circuit-building and evaluation APIs and provides a CLI entry point. The documented user workflow is to write a TypeScript/React circuit, develop and preview it with the CLI, then export manufacturing files. Most design, rendering, routing, and export behavior belongs to dependent packages rather than source implemented here; the graph distinguishes those dependencies and README-documented capabilities from the small local wrapper.

Main entry points: [`index.ts`](https://github.com/tscircuit/tscircuit/blob/main/index.ts) (Circuit API exports), [`cli.mjs`](https://github.com/tscircuit/tscircuit/blob/main/cli.mjs) (CLI launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Circuit authoring"]
  node_core["Circuit core"]
  node_react_fiber["React Fiber renderer"]
end

subgraph group_runtime["Package runtime"]
  node_circuit_api["Circuit API exports<br/>[index.ts]"]
  node_eval["Circuit evaluation"]
  node_cli_entry["CLI launcher<br/>[cli.mjs]"]
end

subgraph group_design["Design capabilities"]
  node_autorouting["PCB autorouting"]
  node_footprints["Footprint import"]
  node_ai_footprints["AI footprint generation"]
end

subgraph group_delivery["Development and output"]
  node_cli["Development CLI"]
  node_preview["PCB and schematic preview"]
  node_registry[("Package registry")]
  node_manufacturing["Manufacturing exports"]
end

node_developer(("Circuit developer"))
node_manufacturer(("Board manufacturer"))

node_developer -->|"authors with"| node_circuit_api
node_circuit_api -->|"re-exports"| node_core
node_circuit_api -->|"re-exports"| node_eval
node_developer -->|"writes circuit components"| node_react_fiber
node_react_fiber -->|"renders circuit"| node_preview
node_developer -->|"starts development"| node_cli_entry
node_cli_entry -->|"imports"| node_cli
node_cli -->|"serves preview"| node_preview
node_developer -->|"uses"| node_autorouting
node_developer -->|"imports components"| node_footprints
node_developer -->|"generates footprints"| node_ai_footprints
node_cli -->|"adds or publishes packages"| node_registry
node_developer -->|"exports design files"| node_manufacturing
node_manufacturing -->|"provides fabrication files"| node_manufacturer

click node_circuit_api "https://github.com/tscircuit/tscircuit/blob/main/index.ts"
click node_cli_entry "https://github.com/tscircuit/tscircuit/blob/main/cli.mjs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_core,node_react_fiber toneBlue
class node_circuit_api,node_eval,node_cli_entry toneAmber
class node_autorouting,node_footprints,node_ai_footprints toneMint
class node_cli,node_preview,node_registry,node_manufacturing toneRose
class node_developer,node_manufacturer toneIndigo
```

## Components

### Circuit authoring

- **Circuit core**
- **React Fiber renderer**

### Package runtime

- [Circuit API exports](https://github.com/tscircuit/tscircuit/blob/main/index.ts): `index.ts`
- **Circuit evaluation**
- [CLI launcher](https://github.com/tscircuit/tscircuit/blob/main/cli.mjs): `cli.mjs`

### Design capabilities

- **PCB autorouting**
- **Footprint import**
- **AI footprint generation**

### Development and output

- **Development CLI**
- **PCB and schematic preview**
- **Package registry**
- **Manufacturing exports**

### Other components

- **Circuit developer**
- **Board manufacturer**

## Connections

- Circuit developer → Circuit API exports: authors with (evidence: `README.md`)
- Circuit API exports → Circuit core: re-exports (evidence: `index.ts`)
- Circuit API exports → Circuit evaluation: re-exports (evidence: `index.ts`)
- Circuit developer → React Fiber renderer: writes circuit components (evidence: `README.md`)
- React Fiber renderer → PCB and schematic preview: renders circuit (evidence: `README.md`)
- Circuit developer → CLI launcher: starts development (evidence: `README.md`)
- CLI launcher → Development CLI: imports (evidence: `cli.mjs`)
- Development CLI → PCB and schematic preview: serves preview (evidence: `README.md`)
- Circuit developer → PCB autorouting: uses (evidence: `README.md`)
- Circuit developer → Footprint import: imports components (evidence: `README.md`)
- Circuit developer → AI footprint generation: generates footprints (evidence: `README.md`)
- Development CLI → Package registry: adds or publishes packages (evidence: `README.md`)
- Circuit developer → Manufacturing exports: exports design files (evidence: `README.md`)
- Manufacturing exports → Board manufacturer: provides fabrication files (evidence: `README.md`)
