Composition and architecture of LeCodes
An engineering description of the LeCodes development environment: what the runtime (LeCodes Runtime) and the lecodes-cli compiler consist of, how they interact, which platforms they run on and which components ship in the distribution. This document is prepared as a technical description of the software.
1. What LeCodes is
LeCodes is a development environment for cross-platform applications written in TypeScript. A developer describes an application's interface and logic with the LeCodes SDK (declarative UI, 2D and 3D scenes, animation, physics); the compiler builds the project into a single portable JS bundle; and the runtime executes that bundle natively on each of the supported platforms — without an embedded browser (WebView) and without installing Node.js on the user's device.
The full pipeline:
Project sources (TypeScript)
│
▼
lecodes-cli compiler ──► app.js (single application bundle)
│
▼
LeCodes Runtime (Windows / Linux / Astra Linux / macOS / iOS / Android / Web)The same compiled bundle runs on every platform: the platform-specific part is fully encapsulated inside the runtime.
2. LeCodes Runtime
The runtime is a native (C++) execution environment for LeCodes applications. It consists of a platform-independent core and thin platform "hosts" that provide the core with a window, a graphics context, input, audio and networking.
2.1. Execution core — creator-pkg
Connects the application's JavaScript code to the native subsystems. It includes:
- JavaScript engine — QuickJS. An embeddable ECMAScript interpreter (shipped as source, with our own patches to the microtask-queue handling). Each application runs in an isolated JS context; system access is only possible through the APIs the environment explicitly exposes.
- JS ↔ native bridge. Bindings of the native subsystems into the JS context (
_creator— 3D,_creatorUI— interface,_creator2d— 2D,_creatorUtils— utilities), and dispatch of calls between threads (JsDispatch / DispatchBridge). - Timing and animation subsystem. Timers (
setTimeout/setInterval), a per-frame scheduler, an animation manager (tweens, easing curves). - 3D asset loader. Parsing and loading of models in the glTF/GLB format.
- Navigation and screens. The application's screen stack, lifecycle, touch/pointer handling and forwarding of events to the UI subsystem.
2.2. UI subsystem — creator-ui
A platform-independent user-interface core:
- element layout via the flexbox model;
- styles: colors, borders, corner radii, gradients, shadows, transforms;
- animatable property transitions;
- virtualized lists (only visible elements are drawn);
- output as a list of draw commands executed by the platform renderer (see 2.4).
2.3. Graphics engines
- 3D —
creator-gl. Built on Google Filament's rendering engine (physically based rendering, PBR): scenes, cameras, lighting, materials, skeletal animation and morphing, textures (PNG/JPEG/KTX2), environment (IBL). Graphics APIs: OpenGL / OpenGL ES / WebGL (via the WebAssembly build), Metal (iOS/macOS). The Jolt Physics engine can optionally be attached (rigid bodies, collisions, character controller). - 2D —
creator-2d. A lightweight 2D engine on the sokol graphics library (sprites, atlases, layers) with Box2D 2D physics.
2.4. Platform hosts
| Platform | Host | UI rendering | Graphics | Notes |
|---|---|---|---|---|
| Windows 10/11 x64 | LeCodes Desktop (creator-desktop) | tgfx | OpenGL | Audio — miniaudio; video — Media Foundation; SVG — nanosvg |
| Astra Linux / Ubuntu x64 | LeCodes Desktop (creator-desktop) | tgfx | OpenGL ES 3 / X11 | glibc ≥ 2.24; audio — miniaudio |
| Android | JNI module creator-pkg + native renderer (Kotlin) | native renderer | OpenGL ES | NDK build (clang, libc++) |
| iOS / macOS | native host | native renderer | Metal / OpenGL | Built as a separate project |
| Web | WebAssembly builds of creator-gl / creator-ui (Emscripten) | canvas renderer | WebGL | Used by the le.codes online editor |
The desktop host additionally provides:
- launching an application from a local file (
creator-desktop app.js) or by the URL of a published project (creator-desktop https://le.codes/qr/<id>); - a WebSocket client for development mode: hot reload of the application when sources change (
lecodes dev), without restarting the process; - I/O subsystems: application files, networking (fetch), media (audio/video).
2.5. Executable application format
A LeCodes application is a single JS file (bundle) that contains all the project's code and references to its assets (models, images, fonts, sounds). The bundle contains no native code and is identical across all platforms; it is executed by the QuickJS interpreter inside the runtime.
3. The lecodes-cli compiler
lecodes-cli is the developer's command-line tool: a project compiler and an instrument for working with the le.codes platform. It ships as a self-contained executable (windows-x64, linux-x64 — a static musl build, a single binary for all Linux distributions), does not require an installed Node.js, and is also published as the npm package lecodes-cli.
3.1. Compilation
- chisel bundler (in-house, written in Rust) — packages the project at method-level granularity: only the SDK and project code that is actually used ends up in the final bundle (aggressive dead-code elimination).
- SDK compiler — translates the project's TypeScript sources, resolves modules without external imports, and inlines assets (for example, SVG icons are expanded into inline sources at build time).
- The result is
app.js, ready to be executed by any LeCodes Runtime (lecodes preview -o app.js).
3.2. Commands
| Group | Commands | Purpose |
|---|---|---|
| Authentication | login | Sign in with a personal access token |
| Project workflow | create, clone, pull, push, status, diff | Create, clone and synchronize projects with the platform (a model similar to version-control systems) |
| Build and run | preview, render | Local compilation to a bundle, screen rendering |
| Development mode | dev | A local network (LAN) server: a QR code to connect a device, hot reload of the application when files change (WebSocket) |
| Prototyping | design | An interactive screen board for designing interfaces |
3.3. Development mode (lecodes dev)
The CLI starts a local server, watches the sources, rebuilds the bundle on changes and pushes the update over WebSocket to connected runtimes (the desktop application or a mobile device connected via a QR code). The update is applied without a restart: the runtime creates a new isolated JS context and scene, freeing the resources of the previous version.
4. Build and distribution
- The Desktop application's version is pinned in the
VERSIONfile, the CLI version in thelecodes-clipackage; changes are tracked inCHANGELOG.md. - Release builds: Windows (MSVC + clang-cl for QuickJS), Ubuntu (GCC), Astra Linux (built inside a Docker environment of the target OS).
- Artifacts are published to immutable storage
releases/<product>/<version>/<archive>; the size and a SHA-256 checksum are recorded for each file. The public manifest of all versions isversions.json.
5. Development scope and third-party components
Developed in-house: the execution core creator-pkg, the UI core creator-ui, the 3D layer creator-gl, the 2D engine creator-2d, the Windows/Linux desktop hosts, the mobile hosts, the LeCodes SDK, the chisel compiler/bundler, lecodes-cli, and the le.codes server platform.
Third-party components are embedded in the distribution as source code or static libraries (no external downloads happen at runtime) and are distributed under permissive free licenses:
| Component | Purpose | License |
|---|---|---|
| QuickJS | JavaScript engine | MIT |
| Google Filament | 3D rendering engine | Apache-2.0 |
| Jolt Physics | 3D physics | MIT |
| tgfx | 2D UI rasterization (desktop): shapes, text, images | BSD-3-Clause |
| sokol | Graphics foundation of the 2D engine | zlib |
| Box2D | 2D physics | MIT |
| miniaudio | Audio playback (desktop) | MIT-0 / Public Domain |
| nanosvg | SVG parsing (desktop) | zlib |
| stb_image | Image decoding | MIT / Public Domain |
Build tools (not included in the shipped end products): CMake, clang/GCC/MSVC, Emscripten (WebAssembly builds), Bun (packaging the self-contained CLI binary).
6. Supported platforms (summary)
| Product | Platforms |
|---|---|
| LeCodes Runtime (Desktop) | Windows 10/11 x64; Astra Linux x64; Ubuntu/compatible (glibc ≥ 2.24) |
| LeCodes Runtime (mobile) | Android; iOS |
| LeCodes Runtime (Web) | Modern browsers (WebAssembly + WebGL) |
| lecodes-cli | Windows x64; Linux x64 (static build); macOS; any OS with Node.js ≥ 18 (npm package) |