Skip to content
moonbit-communityPublic

About

A MoonBit framework for building native desktop applications with a web frontend

Resources

Stars

48 stars

Watchers

1 watching

Forks

Repository files navigation

Proton

Proton is a MoonBit framework for building native desktop applications with a web frontend. It embeds Chromium through CEF and bundles the browser engine with the application on each supported platform.

  • Native windows, embedded browser views, menus and application lifecycle.
  • Typed commands and events between the frontend and native MoonBit code.
  • Operating-system capabilities through extensions, with explicit permissions.
  • Development tooling and packaging for macOS Apple Silicon, Windows x64 and Linux x64.

English documentation · 中文文档

Quick start

This README targets Proton 0.6.0. Changes to project creation are described in the unreleased notes.

Install MoonBit and the native build prerequisites for your platform. The default template uses Rabbita for its MoonBit frontend and Warren to serve and build it; install Node.js/npm as described in the prerequisites. Run these commands outside another MoonBit workspace:

moon install moonbit-community/proton_cli@0.6.0
moon install moonbit-community/warren@0.4.5
proton_cli new my-app
cd my-app
moon update
proton_cli cef setup
proton_cli dev

You can create the same project directly with moon-new. Replace the proton_cli new my-app command above with:

moonx moonbit-community/moon-new my-app \
  --template moonbit-community/proton --branch main \
  --subdir templates/isomorphic

Use --subdir templates/minimal for the minimal template. Direct creation does not require installing proton_cli; keep the CLI for the subsequent development, build and packaging commands.

The default isomorphic template creates a working Todo application with three modules: a shared command contract, a Rabbita frontend and a native backend. dev starts the configured frontend server and opens the desktop application. The list is held in memory and resets when the application restarts.

cef setup downloads the release-matched Chromium runtime and subprocess helper into a shared user-level store. Its first run requires network access and can take several minutes. Keep the CLI and application dependencies on the same Proton release.

Follow the Todo tutorial to extend the generated application. For a smaller app with inline HTML and no frontend tooling, use --template minimal and follow the minimal application tutorial.

Application API

An application's native entry point configures an App and runs it. For example, an inline-HTML app inside a generated 0.6.0 minimal project can use:

async fn main {
  @proton.html("Hello Proton", "<h1>Hello from MoonBit</h1>")
  ..config(@proton.load_config())
  .run_or_abort()
}

config applies the project's configuration before run_or_abort(). Entries can also load URLs, files or bundled assets. Applications register commands explicitly; shared contracts describe their payloads and results. See the application API reference for lifecycle, windows, browser contents, commands, events and capabilities.

Build and package

From the generated project directory, stop the development app, then build:

proton_cli build -- --release

Packaging assembles the executable, frontend assets, browser runtime and helper into a distribution for the current host platform. Review the packaging prerequisites before running:

proton_cli package --dry-run
proton_cli package --release

The default scaffold has no icons. Linux AppImage packaging requires a PNG icon and appimagetool; NSIS output on Windows requires NSIS. The packaging reference explains formats, installation scope, resources, signing and notarization. --release does not enable signing, and a dry run does not create an artifact.

For configuration or startup problems, run proton_cli doctor and consult the diagnostics reference.

Documentation

Topic Reference
Architecture and processes How Proton runs an application
Tutorials Minimal app, complete Todo app
Command Line Interface All commands and options
Configuration All proton.project.json fields
Application API Types, lifecycle and platform behavior
Examples Runnable examples
Release notes Changes and migration guidance
Extensions Available capability modules
Standalone packaging Package prebuilt executables
CDP automation Connect external automation clients

Contributing

See the maintainer guide for repository structure, build and test commands, native ownership rules and contribution requirements.

License

Apache License 2.0. See LICENSE.md.

About

A MoonBit framework for building native desktop applications with a web frontend

Resources

Stars

48 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages