DEV Community

Cover image for A GUI JavaScript Operating System For The ESP32
Haris
Haris

Posted on

A GUI JavaScript Operating System For The ESP32

GitHub logo Haris16-code / KryonOS

KryonOS is an ESP32 GUI operating system with a JavaScript runtime for apps. It provides a real touch-based interface and allows installing and running JS apps dynamically without reflashing firmware.

KryonOS

KryonOS is an open-source, lightweight, high-performance GUI Operating System and JavaScript App Runtime designed specifically for the ESP32 microcontroller. It provides a complete desktop-like experience on embedded devices, featuring an integrated JS engine (Duktape) for executing standalone JavaScript applications, double-buffered graphics for smooth 2D/3D rendering, an App Store, file management, and direct hardware API access.

ESP32 + ILI9341 2.8" (Touch) Multiple Devices (Lab Overview) M5Stack Cardputer CYD (Cheap Yellow Display) LilyGO T-HMI
Stable 🟢 Experimental 🧪 Experimental 🧪 Experimental 🧪 Experimental 🧪
ESP32 ILI9341 Stable Hardware Overview Cardputer CYD T-HMI

Features

  • JavaScript App Runtime: Execute interactive JS apps natively on the ESP32 using the optimized Duktape engine.
  • Rich UI & Graphics: Built-in graphics library with double-buffering support for smooth, tear-free 2D and 3D rendering.
  • App Store & Installer: Browse, download, and install JavaScript apps and updates dynamically over Wi-Fi.
  • File Management: Fully functional file explorer and text editor utilizing the SD Card for storage.
  • Hardware API:…

Meet KryonOS: An Open-Source Graphical OS and JavaScript Runtime for the ESP32

Microcontrollers have advanced far beyond simple sensor telemetry and blinking LED loops. With dual-core 240MHz processors and high-speed external PSRAM, modern chips like the ESP32 and ESP32-S3 can run full-fledged operating environments. That vision led to KryonOS: an open-source graphical operating system featuring an embedded JavaScript application engine, native 3D hardware graphics, and modern networking capabilities.


ESP32 + ILI9341 2.8" (Touch) Multiple Devices (Lab Overview) M5Stack Cardputer CYD (Cheap Yellow Display) LilyGO T-HMI
Stable 🟢 Experimental 🧪 Experimental 🧪 Experimental 🧪 Experimental 🧪
ESP32 ILI9341 Stable Hardware Overview Cardputer CYD T-HMI

Why an OS on a Microcontroller?

Typically, developing for an ESP32 requires flashing monolithic firmware via PlatformIO or the Arduino IDE for every tweak. Changing a button's position or tweaking game logic means a full recompile and reflash cycle.

KryonOS shifts this paradigm by establishing a clear boundary between the native C++ core kernel and high-level applications:

  • Native C++ Kernel: Manages FreeRTOS task scheduling, display SPI DMA channels, touchscreen interrupts, power management, and storage partitions.
  • Embedded JavaScript Engine: Runs isolated user applications dynamically loaded from an SD card or internal LittleFS flash without recompiling firmware.
  • Unified System APIs: Gives developers high-level JavaScript access to graphics primitives, networking, audio, file storage, and hardware sensors.

Hardware-Accelerated 3D on a Microcontroller: The Kryon3D Engine

A flagship highlight of KryonOS is Kryon3D, a native C++ rasterization pipeline exposed directly to the JavaScript runtime. Built for double-buffered, tear-free rendering on TFT displays (like the ILI9341), it handles the heavy math at bare-metal speeds:

  • Hardware Shading & Lighting: Directional lighting calculations and backface culling to maximize polygon throughput.
  • FastMath Acceleration: Vector, matrix, and trigonometric operations offloaded to native routines for 30–60 FPS scene updates.
  • Composite 2D + 3D Rendering: Render a 3D scene (cubes, wireframe meshes, or billboards) and composite 2D HUD text, crosshairs, or mini-maps directly in the same frame buffer before a single DMA flush to the display glass.
  • Distance Fog & Camera Models: Standard 3D world coordinates with 6-DOF camera controls and fog blending.

Modern Networking: Full REST, Streaming, and WebSockets

Connected IoT and handheld devices need reliable communication without blocking the UI. KryonOS implements a non-blocking network architecture that avoids Task Watchdog (TWDT) panics and handles memory safely:

  • Complete REST API: Native Network.get(), post(), put(), delete(), and request() bindings with configurable timeouts.
  • Memory-Optimized TLS: Uses Maximum Fragment Length Negotiation (MFLN) to drop mbedTLS buffer usage from 32 KB down to ~3 KB, leaving internal SRAM free for execution.
  • Direct Storage Streaming: Network.downloadFile() streams remote files into LittleFS or SD storage in 1024-byte chunks with real-time download progress callbacks, preventing heap exhaustion.
  • W3C-Standard WebSockets: Native C++ engine with automated 20-second ping/pong frames to keep NAT connections alive for live telemetry and IoT dashboards.
  • Smart Wi-Fi Manager: Multi-network persistence (known_networks.json) with RSSI sorting, automatic failover, and lightweight WAN reachability verification.

Sample: Running a 3D Scene in JavaScript

Writing an application for KryonOS is straightforward for anyone familiar with basic JavaScript:

// Initialize 3D Viewport in PSRAM
if (Kryon3D.begin(240, 320, 16)) {
    Kryon3D.setCamera(0, 2.0, -4.0, 0, 0, 0, 60);
    Kryon3D.setLight(0.5, 1.0, -0.7, 0.3, 0.7);

    var angle = 0;

    while (true) {
        Kryon3D.clear(0x0000); // Clear buffer

        // Draw a rotating lit 3D cube
        angle += 0.05;
        Kryon3D.drawCube(0, 0, 0, 1.5, 1.5, 1.5, angle, angle * 0.5, 0, 0xFD20, true);

        // Draw 2D HUD over 3D scene
        System.drawString("FPS: 30", 10, 10, 2);

        // Push frame to physical glass (Zero Flickering)
        Kryon3D.render(0, 0);

        System.delay(16);
    }
}

Hardware Support: Stable vs. Experimental Boards

KryonOS is built to support a range of popular maker hardware, with clear milestones across devices:

  • ESP32 + ILI9341 2.8" SPI Touch: The flagship reference platform with full, battle-tested Stable support.
  • ESP32 Cheap Yellow Display (CYD): While we ran experimental builds of KryonOS v1.0.0 during internal lab testing, those were not published as standalone binaries. With v2.0.0, CYD is officially supported with a fully tested, stable binary ready to flash directly to your board.
  • M5Stack Cardputer & LilyGO T-HMI: Currently in active Experimental status as we optimize key layouts and display bus timings.

Check out the repository, run the code on your own hardware, or leave a star to follow along with the upcoming v2.0.0 release!

Explore the KryonOS GitHub Repository

GitHub logo Haris16-code / KryonOS

KryonOS is an ESP32 GUI operating system with a JavaScript runtime for apps. It provides a real touch-based interface and allows installing and running JS apps dynamically without reflashing firmware.

KryonOS

KryonOS is an open-source, lightweight, high-performance GUI Operating System and JavaScript App Runtime designed specifically for the ESP32 microcontroller. It provides a complete desktop-like experience on embedded devices, featuring an integrated JS engine (Duktape) for executing standalone JavaScript applications, double-buffered graphics for smooth 2D/3D rendering, an App Store, file management, and direct hardware API access.

ESP32 + ILI9341 2.8" (Touch) Multiple Devices (Lab Overview) M5Stack Cardputer CYD (Cheap Yellow Display) LilyGO T-HMI
Stable 🟢 Experimental 🧪 Experimental 🧪 Experimental 🧪 Experimental 🧪
ESP32 ILI9341 Stable Hardware Overview Cardputer CYD T-HMI

Features

  • JavaScript App Runtime: Execute interactive JS apps natively on the ESP32 using the optimized Duktape engine.
  • Rich UI & Graphics: Built-in graphics library with double-buffering support for smooth, tear-free 2D and 3D rendering.
  • App Store & Installer: Browse, download, and install JavaScript apps and updates dynamically over Wi-Fi.
  • File Management: Fully functional file explorer and text editor utilizing the SD Card for storage.
  • Hardware API:…

Support KryonOS

If you find KryonOS useful and want to support its development, you can contribute toward new hardware, testing, and support for additional boards.

Support KryonOS

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.