Skip to content

Early development

Mikro.js is in its early days. APIs may change, and you should expect bugs. Not intended for safety-critical or production applications. Use at your own risk!

Getting Started

This guide walks you through creating a Mikro.js project, flashing firmware to a board, and deploying your first TypeScript program.

Prerequisites

  • Node.js >= 24 (npm, pnpm, or yarn)
  • A USB-C cable
  • An ESP32 development board

Bun is untested

Bun has not been tested with Mikro.js. Use npm, pnpm, or yarn for now.

Which board should I use?

We recommend the Seeed Studio XIAO ESP32C6. It's small, cheap (~$5), has USB-C, and works out of the box with Mikro.js. Any ESP32, ESP32-S3, or ESP32-C6 board will work.

Create a project

npm create mikrojs -- my-app
sh
cd my-app
npm install

This scaffolds a project with the following structure:

my-app/
├── app/
│   └── main.ts       # Your program entry point
├── package.json
└── tsconfig.json

Plug in your board

Connect your ESP32 board to your computer via USB-C.

Flash the firmware

npx mikro flash

This writes the Mikro.js runtime firmware into the board's flash memory, setting up the environment your TypeScript code runs in. You only need to do this once per board (or when updating Mikro.js).

Write your program

Open app/main.ts and write a blink program:

ts
import {digitalWrite, pinMode} from 'mikrojs/pin'
import {sleep} from 'mikrojs/sleep'

const LED = 20

pinMode(LED, 'OUTPUT').orPanic('Failed to set pin mode')

while (true) {
  digitalWrite(LED, 1)
  await sleep(500)
  digitalWrite(LED, 0)
  await sleep(500)
}

Run it

npx mikro dev

This builds your TypeScript, deploys it to the board over serial, and watches for changes. Every time you save main.ts, the new code is sent to the device within seconds.

Next steps