Boxlang runtime desktop

From ortus-docs/coldbox-docs · View interactive version

Boxlang runtime desktop is an AI agent skill from the GitHub repository ortus-docs/coldbox-docs. Use this skill when building BoxLang desktop applications with Electron and the BoxLang MiniServer, including process lifecycle wiring, miniserver.json-driven development control, runtime/Package.bx packaging, .boxlang-dev.json versus .boxlang.json behavior, default /app and /public mappings, and cr

How to use this skill

Skill file

BoxLang Desktop Runtime (Electron + MiniServer)

Overview

This skill applies to desktop applications that embed BoxLang using Electron and run a local BoxLang MiniServer process.

Core model:

This pattern gives a desktop UX without replacing BoxLang with another backend stack.


Architecture Baseline

Expected module boundaries:

Preserve modular boundaries in app/electron/* instead of collapsing logic into a single file.


Packaging Model

Package the MiniServer runtime, not Java:

Important runtime constraint:


Configuration Responsibilities

`miniserver.json` (development server control)

Use this as the primary local server control file for desktop development:

Example:

{
    "port": 59700,
    "host": "127.0.0.1",
    "webRoot": "public",
    "serverHome": ".boxlang",
    "rewrites": true,
    "debug": false,
    "envFile": ".env"
}

`.boxlang-dev.json` vs `.boxlang.json`

Use split runtime config for predictable behavior:

Both should include baseline mappings so classes/templates resolve predictably:

"/app": {
    "path": "${user-dir}/app",
    "external": false
},
"/public": "${user-dir}/public"

Startup and Readiness Pattern

Recommended process flow in BoxLang.js:

  1. Detect packaged runtime executable and fallback command.
  2. Ensure execute permission on Unix-like systems.
  3. Spawn MiniServer with miniserver.json.
  4. Poll server URL readiness with timeout and retry interval.
  5. On ready: load BrowserWindow URL.
  6. On crash: apply controlled restart strategy with delay and user notification.

Checklist for robust lifecycle handling:


Build and Packaging Workflow

Common script set for this runtime style:

Use package:full for distributable builds.


BoxLang and Runtime Rules


Troubleshooting Guide

MiniServer fails to start

Permission denied on Unix-like hosts

App runs but UI assets missing

Runs on dev machine but fails on user machine


Best Practices

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.