This guide creates and runs a minimal Lepus application.
Add the dependency from the application root:
moon add lepus-apps/lepusImport Lepus from the package containing the executable:
import {
"lepus-apps/lepus",
}
options(
is-main: true,
)Lepus currently targets native builds.
Create main.mbt:
///|
async fn main {
@lepus.Window(
label="main",
title="My Lepus App",
width=960,
height=640,
source=@lepus.Source::html(
#|<!doctype html>
#|<html>
#| <body>
#| <h1>My Lepus App</h1>
#| </body>
#|</html>
),
).run()
}Window(...) is the convenience API for one window. For multiple windows,
construct WindowConfig values and pass them to App::new.
From the Lepus source checkout:
moon run --target native cli/lepus -- doctor --cwd /path/to/appThe doctor checks MoonBit, module/config presence, WebView library resolution, and the current platform.
For an application without a frontend package:
moon run --target native main.mbtWhen using the Lepus CLI:
moon run --target native /path/to/lepus/cli/lepus -- dev --cwd /path/to/appIf the frontend directory contains package.json, dev starts Vite at
127.0.0.1:2333 by default and sets LEPUS_DEV_URL for the native process.
Otherwise it runs the MoonBit entry directly.
Source::html(text)for self-contained pages and prototypes.Source::Local(path)for built frontend assets.Source::Url(url)for a development server or remote page.Source::zip(bytes)for an in-memory frontend archive.
Use WindowConfig::set_source to replace a source, or navigate(url) as a
shortcut for Source::Url(url).
- Configure windows: Windows and events
- Install native capabilities: Plugins
- Build and package: CLI reference
- Understand process boundaries: Architecture