Ecosystem & Configuration

These pages cover the tools around Cuttlefish: how to create a new project, describe a board so Cuttlefish understands it, handle custom hardware designed in typeCAD, and drive everything from the command line. If you’re new, start with Project Scaffolding to get a working project on your machine.


Topics

TopicWhat you’ll learn
Project ScaffoldingCreate new Cuttlefish projects with cuttlefish create
Board DefinitionsUse or create board definition packages
ContractsUse typeCAD contracts for custom hardware
CLI ReferenceFull command-line reference for cuttlefish

Package Ecosystem

PackagePurpose
@typecad/cuttlefishTurns TypeScript into C++ for native, Arduino, and direct hardware targets
@typecad/halHardware Abstraction Layer — the parts you call in your code
@typecad/uiHTML/CSS-driven UI authoring library for microcontrollers
@typecad/expectHardware test framework — vitest-style assertions over serial
@typecad/simulatorHardware simulation runtime for Node.js
@typecad/mcu-atmega328pMCU definition for ATmega328P
@typecad/mcu-esp32MCU definition for ESP32
@typecad/mcu-esp32s3MCU definition for ESP32-S3
@typecad/framework-avrAVR native register-level code generation
@typecad/framework-arduinoArduino framework code generation
@typecad/framework-nativeNative C++ for desktop builds (g++/clang++)
@typecad/board-arduino-unoBoard definition for Arduino Uno Rev3
@typecad/board-esp32-devkitBoard definition for ESP32 DevKit v1
@typecad/board-esp32s3Board definition for ESP32-S3

Quick Start

Create a new project in one command:

npx cuttlefish create my-project --target arduino-uno
cd my-project
npm install
npm run compile

Available targets for --target: native (desktop), arduino-uno, esp32-devkit, esp32s3. Run cuttlefish create with no --target for an interactive wizard.

Project Configuration

Each Cuttlefish project has a cuttlefish.config.ts that defines the entry point, target architecture, MCU, board, framework, and output settings. This file is auto-generated by the scaffolder but can be customized:

import type { CuttlefishConfig } from '@typecad/cuttlefish/api';

const config: CuttlefishConfig = {
  entry: './src/sketch.ts',
  target: 'esp32',
  mcu: '@typecad/mcu-esp32',
  board: '@typecad/board-esp32-devkit',
  framework: '@typecad/framework-arduino',
  frameworkData: {
    buildTarget: 'esp32:esp32:esp32',
  },
  output: {
    framework: 'arduino',
    optimize: 'size',
    outDir: './out',
  },
};

export default config;

Key fields:

  • entry — the TypeScript (or .ui) entry point.
  • target — architecture: avr, esp32, esp32s3, or native.
  • mcu — the low-level chip pin/port definitions package (e.g. @typecad/mcu-esp32).
  • board — the board-level pin aliases and peripheral mappings (e.g. @typecad/board-esp32-devkit).
  • framework — the code-generation strategy package.
  • frameworkData.buildTarget — the FQBN (the board ID Arduino uses) passed to arduino-cli.
  • outputframework (matching the strategy), optimize (size/speed), outDir.

Use board for standard development boards, or mcu + contract for custom PCBs designed in typeCAD (see Contracts).

Build Commands

The typical workflow uses these npm scripts (auto-generated in package.json):

npm run build     # Transpile to C++
npm run compile   # Transpile + compile
npm run upload    # Transpile + compile + upload
npm run monitor   # Open serial monitor

Or use the CLI directly:

cuttlefish build --compile --upload --port COM4
cuttlefish build --watch --compile    # Auto-rebuild on changes
cuttlefish build --diagnostics        # Generate diagnostics report

See CLI Reference for all commands and flags.