0.0.114 • Published 2 days ago

tscircuit v0.0.114

Weekly downloads
-
License
-
Repository
-
Last release
2 days ago

⏣ tscircuit - React for Circuits

Docs · Website · Twitter · Campfire · Quickstart · Online Playground

NPM Version npm.io

Make electronics using Typescript and React.

npm install -g tscircuit

tscircuit is a library complemented by a registry, package manager, and command line tool that makes it easy to create, share, export and manufacture electronic circuits. It uses React Fiber to render circuits into web pages.

const Circuit = () => (
  <board width="50mm" height="50mm" center_x={0} center_y={0}>
    <MySubcomponent
      name="U1"
      center={[0, 0]}
      footprint="sot236"
    />
    <resistor
      x={2}
      y={-0.5}
      name="R1"
      resistance="10ohm"
      footprint="0805"
      pcb_x="4mm"
      pcb_y="-1mm"
    />
    <ground x={3} y={1} name="GND" />
    <trace path={[".U1 > .D0", ".R1 > .left"]} />
    <trace path={[".R1 > .right", ".GND > .gnd"]} />
  </board>
)

Example Circuit Rendering

https://github.com/tscircuit/tscircuit/assets/1910070/63610730-41e6-4a00-9748-e4c3691e5ca9

Getting Started

You can do everything you need to do with tscircuit using the tsci command line tool.

npm install -g tscircuit

tsci dev

Open your browser to http://localhost:3020!

tsci Server Preview

More Features!

  • Preview PCBs & Schematics in your browser
  • Use normal Typescript/React tooling
  • Export Gerbers, Pick'n'Place and BOM for manufacturing
  • Add registry packages with tsci add
  • Publish subpackages to the registry with tsci publish
  • Simplified, extensible auto-routing for schematics and PCBs

FAQ

Is tscircuit free?

tscircuit is completely free and MIT-licensed open-source

How does this work?

tscircuit uses the same thing that React Native and react-three-fiber use to render to mobile or 3d to render PCBs and schematics (it's called React Fiber!)

You can render schematics or PCBs in any React project like this:

import { Schematic } from "@tscircuit/schematic-viewer"

export const MyApp = () => (
  <div>Regular web react here!</div>
  <Schematic>
   <resistor name="R1" resistance="10k" />
  </Schematic>
)

tscircuit has a bunch of extra tools and exports in the command line, so it's a bit easier to use tsci dev to develop circuits (you can always publish and import them later)

Is this ready for production?

No! Although I've ordered a fully assembled circuit (source code), this project is still very very early!

How does the registry work?

The tscircuit registry fully implements the npm registry. When you run tsci init a .npmrc file is created in your project so that any npm add or npm install for a package starting with @tsci/* will go to the tscircuit registry instead of the npm registry.

# Example .npmrc
# This line says "any package from the org @tsci should use the tscircuit registry server
@tsci:registry=https://registry-api.tscircuit.com/npm

Can I use a different registry?

Yes! You can use the same trick and modify the .npmrc file for your project. You can run your own npm registry with verdaccio

Why are some things upside down?

If you see something upside down, it's because mid-April the Y Axis was flipped so that "up" would mean the Y value would increase for both schematics and PCBs. In web development, the Y axis is negative as you go up, but this probably isn't a good choice an engineering tool so now the Y Axis is positive and some things are upside down until they're fixed.

Can I test this in my browser?

Yes! There is a playground tool!

Do I have to specify the position of every component?

I'm working on autolayout functionality where you will hopefully only need to tweak things like the spacing. The goal of anything auto

Is the auto-routing good?

The auto-routing is very basic. You can adjust the paths by adding pcb_route_hints to a <trace />. Over time, we'll get good, fast auto-routing algorithms and also ways to "bake & cache" a route over a longer time period.

Can I export into other tools for routing?

This isn't currently possible but a major current objective. If you're interested in writing a module that can convert tscircuit soup JSON into another editor's format, reach out on our campfire!!

I found a bug or have an idea for a feature, what should I do?

Please create an issue!

How can I follow along?

Does this use AI?

No, but AI is pretty good at generating circuits! Try it with copilot!

What big features are coming?

  • Type-safe traces
  • Lots of ways to use hooks to do more complex, safe circuits
  • Autolayout and autorouter improvements
  • Layout and route "baking" for more complex routes/layouts
  • Lots and lots of static analysis
  • SPICE output!
  • Export to other EDA tools
  • Less bugs! A lot less bugs!

Development Sub-Projects / Organization

tscircuit includes a lot of different independently-runnable sub-projects. Here's a quick guide to navigating all of the sub-projects:

Core Libraries

ProjectDescription
tscircuitThe main package, packages up everything into a single version
@tscircuit/builderA typescript-native library for building circuits (no React). Converts typescript into "the soup format"
@tscircuit/cliThe tscircuit command line tool tsci and development environment
@tscircuit/schematic-viewerThe Schematic renderer
@tscircuit/pcb-viewerThe PCB renderer
@tscircuit/react-fiberBindings from builder to React, React types
@tscircuit/routingRouting algorithms for schematic and PCB traces
@tscircuit/autolayoutLayout algorithms for schematics

Other Links

0.0.114

2 days ago

0.0.109

4 days ago

0.0.108

4 days ago

0.0.107

4 days ago

0.0.113

2 days ago

0.0.112

2 days ago

0.0.111

3 days ago

0.0.110

3 days ago

0.0.106

5 days ago

0.0.105

5 days ago

0.0.104

5 days ago

0.0.103

5 days ago

0.0.102

6 days ago

0.0.101

7 days ago

0.0.100

7 days ago

0.0.99

7 days ago

0.0.98

8 days ago

0.0.97

10 days ago

0.0.84

12 days ago

0.0.85

12 days ago

0.0.86

12 days ago

0.0.87

12 days ago

0.0.88

12 days ago

0.0.89

12 days ago

0.0.81

12 days ago

0.0.82

12 days ago

0.0.83

12 days ago

0.0.95

12 days ago

0.0.96

11 days ago

0.0.90

12 days ago

0.0.91

12 days ago

0.0.92

12 days ago

0.0.93

12 days ago

0.0.94

12 days ago

0.0.80

13 days ago

0.0.77

14 days ago

0.0.78

14 days ago

0.0.79

14 days ago

0.0.73

15 days ago

0.0.74

15 days ago

0.0.75

15 days ago

0.0.76

15 days ago

0.0.72

16 days ago

0.0.71

18 days ago

0.0.70

19 days ago

0.0.62

20 days ago

0.0.63

20 days ago

0.0.64

20 days ago

0.0.65

20 days ago

0.0.66

20 days ago

0.0.67

20 days ago

0.0.68

20 days ago

0.0.69

20 days ago

0.0.60

20 days ago

0.0.61

20 days ago

0.0.59

20 days ago

0.0.55

22 days ago

0.0.56

21 days ago

0.0.57

21 days ago

0.0.58

21 days ago

0.0.54

22 days ago

0.0.53

23 days ago

0.0.51

25 days ago

0.0.52

25 days ago

0.0.50

26 days ago

0.0.47

28 days ago

0.0.48

27 days ago

0.0.49

27 days ago

0.0.44

29 days ago

0.0.45

28 days ago

0.0.46

28 days ago

0.0.40

1 month ago

0.0.41

1 month ago

0.0.42

1 month ago

0.0.43

1 month ago

0.0.39

1 month ago

0.0.38

1 month ago

0.0.37

1 month ago

0.0.35

1 month ago

0.0.36

1 month ago

0.0.32

1 month ago

0.0.33

1 month ago

0.0.34

1 month ago

0.0.31

1 month ago

0.0.30

1 month ago

0.0.28

1 month ago

0.0.29

1 month ago

0.0.26

1 month ago

0.0.27

1 month ago

0.0.22

1 month ago

0.0.23

1 month ago

0.0.24

1 month ago

0.0.25

1 month ago

0.0.20

1 month ago

0.0.21

1 month ago

0.0.11

1 month ago

0.0.12

1 month ago

0.0.13

1 month ago

0.0.14

1 month ago

0.0.15

1 month ago

0.0.16

1 month ago

0.0.17

1 month ago

0.0.18

1 month ago

0.0.19

1 month ago

0.0.10

2 months ago

0.0.9

2 months ago

0.0.8

2 months ago

0.0.5

2 months ago

0.0.4

2 months ago

0.0.7

2 months ago

0.0.6

2 months ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago