Convert Figma logo to code with AI

revery-ui logorevery

:zap: Native, high-performance, cross-platform desktop apps - built with Reason!

8,069
197
8,069
114

Top Related Projects

A framework for building native applications using React

164,677

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

A framework for building native Windows apps with React.

17,618

Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS

83,441

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.

Quick Overview

Revery is a cross-platform GUI toolkit for building native, high-performance applications using OCaml and Reason. It leverages the power of native code with the simplicity of functional programming, providing a React-like component model for creating user interfaces.

Pros

  • Cross-platform support (Windows, macOS, Linux)
  • High-performance native rendering
  • Functional programming paradigm with OCaml/Reason
  • React-like component model for familiar development experience

Cons

  • Smaller community compared to mainstream GUI frameworks
  • Limited documentation and learning resources
  • Steeper learning curve for developers unfamiliar with OCaml/Reason
  • Fewer third-party libraries and components compared to more established frameworks

Code Examples

  1. Creating a simple window:
open Revery;
open Revery.UI;

let init = app => {
  let win = App.createWindow(app, "Hello World");

  let element = <View>
    <Text text="Hello, World!" />
  </View>;

  UI.start(win, element);
};

App.start(init);
  1. Handling user input:
let onClick = () => print_endline("Button clicked!");

let element =
  <View>
    <Button title="Click me!" onClick />
  </View>;
  1. Styling components:
let styles = Style.[
  backgroundColor(Colors.red),
  width(100),
  height(100),
  margin(10),
];

let element =
  <View style=styles>
    <Text text="Styled component" />
  </View>;

Getting Started

  1. Install esy (package manager for Reason/OCaml):

    npm install -g esy
    
  2. Create a new Revery project:

    git clone https://github.com/revery-ui/revery-quick-start
    cd revery-quick-start
    esy
    
  3. Run the example:

    esy run
    
  4. Start building your own application by modifying App.re in the src directory.

Competitor Comparisons

A framework for building native applications using React

Pros of React Native

  • Larger community and ecosystem, with more third-party libraries and resources
  • Cross-platform development for iOS and Android with a single codebase
  • Backed by Facebook, ensuring long-term support and regular updates

Cons of React Native

  • Performance can be slower compared to native development, especially for complex animations
  • Larger app size due to the inclusion of the JavaScript runtime
  • Occasional inconsistencies between platforms and need for platform-specific code

Code Comparison

React Native:

import React from 'react';
import { View, Text, StyleSheet } from 'react-native';

const App = () => (
  <View style={styles.container}>
    <Text>Hello, React Native!</Text>
  </View>
);

Revery:

open Revery;
open Revery.UI;

let app = () =>
  <View>
    <Text text="Hello, Revery!" />
  </View>;

App.start(app);

Key Differences

  • React Native uses JavaScript/JSX, while Revery uses ReasonML
  • React Native targets mobile platforms, Revery focuses on desktop applications
  • Revery has a smaller footprint and potentially better performance for desktop apps
  • React Native has a larger ecosystem and more extensive documentation
164,677

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

Pros of Flutter

  • Larger community and ecosystem, with more resources and third-party packages
  • More mature and stable, with extensive documentation and support
  • Cross-platform development for mobile, web, and desktop from a single codebase

Cons of Flutter

  • Larger app size due to bundled runtime and dependencies
  • Steeper learning curve for developers new to Dart programming language
  • Less native look and feel compared to platform-specific UI components

Code Comparison

Flutter:

import 'package:flutter/material.dart';

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Flutter App')),
        body: Center(child: Text('Hello, World!')),
      ),
    );
  }
}

Revery:

open Revery;
open Revery.UI;

let app = () =>
  <View>
    <Text text="Hello, World!" />
  </View>;

App.start(app);

Flutter uses Dart and a widget-based approach, while Revery uses ReasonML and a more functional style. Flutter's code is more verbose but provides a complete app structure, whereas Revery's code is more concise and focuses on the UI components.

A framework for building native Windows apps with React.

Pros of React Native Windows

  • Larger community and ecosystem, with more resources and third-party libraries available
  • Better integration with Windows-specific features and APIs
  • More mature and production-ready for large-scale applications

Cons of React Native Windows

  • Steeper learning curve, especially for developers new to React Native
  • Potentially slower performance compared to native Windows applications
  • Limited cross-platform compatibility (focused on Windows)

Code Comparison

React Native Windows:

import React from 'react';
import { View, Text } from 'react-native-windows';

const App = () => (
  <View>
    <Text>Hello, Windows!</Text>
  </View>
);

Revery:

open Revery;
open Revery.UI;

let app = () =>
  <View>
    <Text text="Hello, World!" />
  </View>;

App.start(app);

Summary

React Native Windows offers a more established ecosystem and better Windows integration, while Revery provides a lightweight, cross-platform solution with potentially better performance. React Native Windows uses JavaScript and React syntax, whereas Revery uses ReasonML, a statically-typed functional language. The choice between the two depends on project requirements, team expertise, and desired platform support.

17,618

Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS

Pros of Kivy

  • Cross-platform support for desktop and mobile (iOS, Android)
  • Large and active community with extensive documentation
  • Rich set of UI widgets and tools for rapid development

Cons of Kivy

  • Performance can be slower compared to native solutions
  • Larger app size due to bundled Python interpreter
  • Steeper learning curve for developers new to Python

Code Comparison

Kivy (Python):

from kivy.app import App
from kivy.uix.button import Button

class MyApp(App):
    def build(self):
        return Button(text='Hello World')

MyApp().run()

Revery (ReasonML):

open Revery;
open Revery.UI;

let app = () =>
  <View>
    <Text text="Hello World" />
  </View>;

App.start(app);

Summary

Kivy is a mature, cross-platform framework with a large community and extensive documentation. It offers a wide range of UI widgets and tools for rapid development. However, it may have performance limitations and larger app sizes compared to native solutions. Revery, on the other hand, is a newer framework that focuses on native performance and smaller bundle sizes, but has a smaller community and less extensive documentation. The choice between the two depends on the specific project requirements, target platforms, and developer expertise.

83,441

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.

Pros of Tauri

  • Smaller bundle sizes and better performance due to native system components
  • Supports multiple programming languages for backend logic (Rust, JavaScript, TypeScript)
  • Strong security features with automatic updates and code signing

Cons of Tauri

  • Steeper learning curve, especially for developers new to Rust
  • Less mature ecosystem compared to Electron-based alternatives
  • Limited cross-platform UI consistency due to reliance on native components

Code Comparison

Tauri (Rust):

#[tauri::command]
fn greet(name: &str) -> String {
    format!("Hello, {}! You've been greeted from Rust!", name)
}

Revery (ReasonML):

let greet = (name) => {
  <Text text={`Hello, ${name}! You've been greeted from ReasonML!`} />
};

Both Tauri and Revery aim to create cross-platform desktop applications, but they take different approaches. Tauri focuses on leveraging native system components and Rust for backend logic, while Revery uses ReasonML and a custom rendering engine. Tauri offers smaller bundle sizes and better performance, but may have less consistent UI across platforms. Revery provides a more unified development experience but may have larger bundle sizes. The choice between them depends on specific project requirements and developer preferences.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Logo

Build native, high-performance, cross-platform desktop apps with reason!

Build Status npm version Join the chat on discord! Backers


Slider components

:construction: NOTE: Revery is a work-in-progress and in active development! :construction:

To get a taste of Revery, check out our JavaScript + WebGL build on the playground. For the best experience, though, you'll want to try a native build.

Motivation

Today, Electron is one of the most popular tools for building desktop apps - using an HTML, JS, CSS stack. However, it has a heavy footprint in terms of both RAM and CPU - essentially packing an entire browser into the app. Even with that tradeoff, it has a lot of great aspects - it's the quickest way to build a cross-platform app & it provides a great development experience - as can be testified by its usage in popular apps like VSCode, Discord, and Slack.

Revery is kind of like super-fast, native code Electron - with bundled React-like/Redux-like libraries and a fast build system - all ready to go!

Revery is built with reasonml, which is a javascript-like syntax on top of OCaml This means that the language is accessible to JS developers.

Your apps are compiled to native code with the Reason / OCaml toolchain - with instant startup and performance comparable to native C code. Revery features platform-accelerated, GPU-accelerated rendering. The compiler itself is fast, too!

Revery is an experiment - can we provide a great developer experience and help teams be productive, without making sacrifices on performance?

Design Decisions

  • Consistent cross-platform behavior

A major value prop of Electron is that you can build for all platforms at once. You have great confidence as a developer that your app will look and work the same across different platforms. Revery is the same - aside from platform-specific behavior, if your app looks or behaves differently on another platform, that's a bug! As a consequence, Revery is like flutter in that it does not use native widgets. This means more work for us, but also that we have more predictable functionality cross-platform!

NOTE: If you're looking for something that does leverage native widgets, check out briskml. Another alternative is the cuite OCaml binding for Qt.

  • High performance

Performance should be at the forefront, and not a compromise - we need to develop and build benchmarks that help ensure top-notch performance and start-up time.

  • Type-safe, functional code

We might have some dirty mutable objects for performance - but our high-level API should be purely functional. You should be able to follow the React model of modelling your UI as a pure function of application state -> UI.

Getting Started

Contributing

We'd love your help, and welcome PRs and contributions.

Some ideas for getting started:

License

Revery is provided under the MIT License.

Revery bundles several dependencies under their own license terms - please refer to ThirdPartyLicenses.txt.

Contributors

Thanks to everyone who has contributed to Revery!

Backers

Thank you to all our backers! 🙏 [Become a backer]

Built with Revery

Onivim 2

Special Thanks

revery would not be possible without a bunch of cool tech:

revery was inspired by some awesome projects:

Hot reload

We don't have a Hot Reload yet but it is on our roadmap. In the meantime, you can check branch feat/hot-reload to see the progression.

In the meantime @mbernat has done a script that allow to relaunch the APP when the binary changed.

NPM DownloadsLast 30 Days