This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
tscircuit.com is a React-based web application for creating, sharing, and managing electronic circuit designs using TypeScript and React. It features a circuit editor, package management system, AI-assisted design tools, and visualization of PCB layouts and 3D models.
bun run dev- Start development server (builds fake API and runs on localhost:5173)bun run build- Full production build (generates images, sitemap, builds fake API, compiles TypeScript, and builds with Vite)bun run typecheck- Run TypeScript type checking without emitting filesbun run format- Format code using Biomebun run lint- Check code formatting with Biomebun run playwright- Run Playwright end-to-end testsbun run playwright:update- Update Playwright test snapshotsbun run snapshot- Interactive snapshot updating tool (prompts for specific test file)
bun run build:fake-api- Build the complete fake API (TypeScript compilation, bundle generation, schema building)bun run dev:registry- Run dev server using registry API at localhost:3100
- React SPA with Vite bundler, using Wouter for routing and lazy-loaded pages
- State Management: Zustand for global state, React Query for server state
- UI Framework: Tailwind CSS with Radix UI components and custom shadcn/ui components
- Code Editor: CodeMirror 6 with TypeScript support and AI completion
- Fake API: Development API built with Winterspec, providing full backend simulation
- Database Schema: Zod-validated schemas for packages, builds, releases, snippets, accounts, orders
- Authentication: Session-based auth with GitHub integration
- Packages: Reusable circuit components with versioning and releases
- Package Builds: Compilation artifacts with build status and logs
- Package Releases: Published versions with metadata and assets
- Snippets: Legacy circuit designs (being migrated to packages)
- Circuit JSON: Standard format for circuit data interchange
src/components/- Reusable UI componentssrc/pages/- Route-based page componentssrc/hooks/- Custom React hooks for data fetching and statesrc/lib/- Utilities, constants, and helper functionsfake-snippets-api/- Mock API implementation with Winterspecplaywright-tests/- End-to-end tests with visual regression snapshots
Uses Playwright for end-to-end testing with visual regression snapshots. Tests cover critical user flows including editor functionality, package management, authentication, and responsive design across viewport sizes.
- React Query for server state with custom hooks (use-package-, use-snippet-, etc.)
- Fake API provides development backend with realistic data simulation
- SSR support via Vercel for SEO and performance
- Multiple viewers: PCB viewer, schematic viewer, 3D viewer, assembly viewer
- SVG-based rendering with interactive controls
- Real-time preview updates during code editing
- TypeScript compilation in browser using Monaco/TypeScript compiler API
- Circuit JSON generation from TypeScript code
- Error handling and display for compilation issues
- Package files with hierarchical structure
- Build artifacts and release management
- GitHub integration for repository linking
Development AI testing requires:
VITE_USE_DIRECT_AI_REQUESTS=true
VITE_ANTHROPIC_API_KEY=<your-key-here>- Bundler: Vite with React plugin and image optimization
- TypeScript: Strict mode with path aliases (@/* → src/*)
- Styling: Tailwind CSS with custom design tokens
- Code Quality: Biome for formatting and linting
- Package Manager: Bun for fast installs and script execution