Introduction

Greenhorn is a rust library for building desktop applications with web technologies in (almost) pure rust.

This is accomplished by separating the application into a server-side process (the backend) and web view implemented in javascript (the frontend). While most HTML-based desktop applications leave state synchronization between frontend and backend up to the application logic, this library synchronizes its state at DOM-level. Thus, the user may implement the application logic purely in the backend using rust and the DOM is automatically synchronized with the frontend. This facilitates the integration of a desktop GUI with system services and simplifies application development considerably.

Deploying

The greenhorn library is not opinionated on how to deploy applications. However, the projects ships additional facilities to deploy applications to common targets.

  • Desktop applications may be deployed using Boscop's WebView. The greenhorn_web_view crates serves as an adapter for it. This is the easiest deployment method for desktop operating systems. Refer to this page for details.

  • greenhorn application may be deployed in a webbrowser. Refer to this page for details and check out this example.

  • Desktop applications may also be deployed with electron. Currently, this the recommended and best tested method.

Examples

A todomvc example is presented in the repository at examples/todomvc:

  • The core application logic is located in the lib crate
  • A deployment example for WebView is given in the webview crate
  • An example of how to deploy with Electron in the electron directory
  • A browser version of the application in the wasm directory

Quickstart

Use the following repository to quick-start development of an electron based application: https://github.com/raffber/greenhorn-electron-quickstart