react-nodegui
Build performant, native and cross-platform desktop applications with native React + powerful CSS like styling.🚀
Top Related Projects
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Build smaller, faster, and more secure desktop applications with a web frontend.
Make any web page a desktop application
:zap: Native, high-performance, cross-platform desktop apps - built with Reason!
A framework for building native Windows apps with React.
Flutter makes it easy and fast to build beautiful apps for mobile and beyond
Quick Overview
React NodeGui is a framework for building native desktop applications using React and Qt. It allows developers to create cross-platform desktop apps with JavaScript, leveraging the power of React's component-based architecture and Qt's native performance.
Pros
- Cross-platform development for Windows, macOS, and Linux
- Utilizes React's component-based architecture for efficient UI development
- Offers native performance through Qt integration
- Smaller bundle sizes compared to Electron-based applications
Cons
- Smaller community and ecosystem compared to Electron
- Limited documentation and learning resources
- Potential compatibility issues with some React libraries
- Steeper learning curve for developers unfamiliar with Qt
Code Examples
- Creating a basic window with a button:
import React from 'react';
import { Renderer, Window, Button } from '@nodegui/react-nodegui';
const App = () => {
return (
<Window windowTitle="Hello World">
<Button text="Click me!" />
</Window>
);
};
Renderer.render(<App />);
- Handling button clicks:
import React from 'react';
import { Button, Text } from '@nodegui/react-nodegui';
const ClickCounter = () => {
const [count, setCount] = React.useState(0);
return (
<>
<Button text="Increment" on={{ clicked: () => setCount(count + 1) }} />
<Text>{`Count: ${count}`}</Text>
</>
);
};
- Styling components:
import React from 'react';
import { View, Text } from '@nodegui/react-nodegui';
const StyledComponent = () => {
return (
<View
style={`
background-color: #f0f0f0;
padding: 10px;
border-radius: 5px;
`}
>
<Text style="color: #333; font-size: 16px;">Styled Text</Text>
</View>
);
};
Getting Started
To start using React NodeGui, follow these steps:
- Install Node.js and npm
- Install the React NodeGui CLI:
npm install -g @nodegui/react-nodegui-cli
- Create a new project:
npx react-nodegui-cli create myapp
- Navigate to the project directory and install dependencies:
cd myapp npm install
- Run the development server:
npm run dev
This will set up a basic React NodeGui project and start the development server, allowing you to begin building your desktop application.
Competitor Comparisons
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Pros of Electron
- Larger ecosystem and community support
- Extensive documentation and resources
- Cross-platform compatibility (Windows, macOS, Linux)
Cons of Electron
- Higher memory usage and larger application size
- Slower performance compared to native applications
- Security concerns due to Chromium's attack surface
Code Comparison
Electron:
const { app, BrowserWindow } = require('electron')
function createWindow () {
const win = new BrowserWindow({ width: 800, height: 600 })
win.loadFile('index.html')
}
app.whenReady().then(createWindow)
React NodeGUI:
import React from "react";
import { Renderer, Window } from "@nodegui/react-nodegui";
const App = () => {
return <Window style={windowStyle} />;
};
Renderer.render(<App />);
React NodeGUI offers a more lightweight alternative to Electron, focusing on native performance and smaller application size. It uses Qt under the hood, providing a native look and feel. However, Electron has a more mature ecosystem, better cross-platform support, and extensive documentation. Electron's larger community also means more third-party packages and resources are available. React NodeGUI may be preferred for performance-critical applications or when minimizing resource usage is crucial, while Electron remains a popular choice for rapid development of cross-platform desktop applications using web technologies.
Build smaller, faster, and more secure desktop applications with a web frontend.
Pros of Tauri
- Smaller bundle sizes and better performance due to native system components
- Supports multiple programming languages (Rust, JavaScript, TypeScript) for backend logic
- 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 solutions
- Limited cross-platform UI consistency due to reliance on native components
Code Comparison
Tauri (main.rs):
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
fn main() {
tauri::Builder::default().run(tauri::generate_context!()).expect("error while running tauri application");
}
React NodeGUI (index.js):
import React from "react";
import { Renderer } from "@nodegui/react-nodegui";
import App from "./app";
Renderer.render(<App />);
Both frameworks aim to create desktop applications using web technologies, but Tauri leverages Rust for its core while React NodeGUI uses Node.js and Qt. Tauri offers more flexibility in language choice and better performance, while React NodeGUI provides a more familiar React-based development experience with consistent cross-platform UI.
Make any web page a desktop application
Pros of Nativefier
- Simpler setup and usage, requiring minimal configuration
- Supports a wide range of web applications out-of-the-box
- Generates standalone executables for multiple platforms
Cons of Nativefier
- Limited customization options for the generated application
- Larger file size due to bundling Electron with each app
- Performance may be slower compared to native applications
Code Comparison
React-NodeGUI:
import React from "react";
import { Renderer, Window, View, Text } from "@nodegui/react-nodegui";
const App = () => {
return (
<Window>
<View>
<Text>Hello, World!</Text>
</View>
</Window>
);
};
Nativefier:
nativefier --name "My App" "https://example.com"
React-NodeGUI allows for more granular control over the application's UI and behavior, utilizing React components to build native desktop applications. It offers better performance and smaller file sizes due to its use of Qt instead of Electron.
Nativefier, on the other hand, provides a quick and easy way to convert web applications into desktop apps with minimal effort. It's ideal for rapid prototyping or creating simple desktop wrappers for web applications, but lacks the flexibility and performance optimizations of React-NodeGUI.
:zap: Native, high-performance, cross-platform desktop apps - built with Reason!
Pros of Revery
- Built with OCaml, offering strong type safety and functional programming benefits
- Leverages the ReasonML ecosystem, providing a familiar syntax for JavaScript developers
- Supports cross-platform development for desktop and web applications
Cons of Revery
- Smaller community and ecosystem compared to React-based solutions
- Steeper learning curve for developers not familiar with OCaml or ReasonML
- Limited native UI component library compared to Qt-based frameworks
Code Comparison
Revery:
let component = React.component("App");
let make = () =>
component(hooks => {
let (count, setCount) = React.useState(0);
<View>
<Text text={string_of_int(count)} />
<Button title="Increment" onClick={() => setCount(count + 1)} />
</View>;
});
React NodeGui:
import React from "react";
import { View, Text, Button } from "@nodegui/react-nodegui";
function App() {
const [count, setCount] = React.useState(0);
return (
<View>
<Text>{count}</Text>
<Button text="Increment" on={{ clicked: () => setCount(count + 1) }} />
</View>
);
}
Both frameworks offer similar component-based structures and state management, but Revery uses OCaml syntax while React NodeGui uses familiar JavaScript/React syntax.
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 stable, with backing from Microsoft
Cons of React Native Windows
- Heavier and more resource-intensive, potentially impacting performance
- Steeper learning curve, especially for developers new to Windows development
- Less flexibility in terms of customization and low-level access
Code Comparison
React Native Windows:
import React from 'react';
import { View, Text } from 'react-native';
const App = () => (
<View>
<Text>Hello, Windows!</Text>
</View>
);
React NodeGui:
import React from 'react';
import { View, Text } from '@nodegui/react-nodegui';
const App = () => (
<View>
<Text>Hello, NodeGui!</Text>
</View>
);
The code structure is similar, but React NodeGui uses its own set of components from the @nodegui/react-nodegui package, while React Native Windows uses components from the react-native package. Both frameworks allow developers to create native Windows applications using React, but with different underlying technologies and approaches to rendering UI components.
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
- Cross-platform development for mobile, web, and desktop from a single codebase
- Hot reload feature for faster development and iteration
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';
void main() {
runApp(MaterialApp(
home: Scaffold(
body: Center(child: Text('Hello, World!')),
),
));
}
React NodeGui:
import React from "react";
import { Renderer, Text, Window } from "@nodegui/react-nodegui";
const App = () => {
return <Window><Text>Hello, World!</Text></Window>;
};
Renderer.render(<App />);
Both frameworks offer declarative UI development, but Flutter uses Dart and its own widget system, while React NodeGui leverages JavaScript/TypeScript and React components. Flutter's syntax is more concise for simple apps, but React NodeGui may feel more familiar to web developers. Flutter's ecosystem is more mature, offering a wider range of pre-built components and tools for complex applications.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
React NodeGui
â ï¸ React NodeGui is no longer maintained. Please fork it to continue development â ï¸
Build performant, native and cross-platform desktop applications with React.ð
React NodeGUI is powered by React âï¸ and Qt5 ð which makes it CPU and memory efficient as compared to other chromium based solutions like electron. React NodeGUI is essentially a React renderer for NodeGUI.
Visit: https://react.nodegui.org for docs.
This project is in active development. It should be okay for smaller projects but anything complex - electron is the way to go for now. ð§
How does it look?
More screenshots?
Features
- 𧬠Cross platform. Should work on major Linux flavours, Windows and MacOS
- ð Low CPU and memory footprint. Current CPU stays at 0% on idle and memory usage is under 20mb for a hello world program.
- ð Styling with CSS (includes actual cascading). Also has full support for Flexbox layout (thanks to Yoga).
- â Complete Nodejs api support (Currently runs on Node v12.x - and is easily upgradable). Hence has access to all nodejs compatible npm modules.
- ðª Native widget event listener support. supports all event available from Qt / NodeJs.
- ð¸ Can be used for Commercial applications.
- ðµï¸ââï¸ Good Devtools support (supports react-devtools, node debugger).
- ð Good documentation and website.
- ð§ââï¸ Good documentation for contributors.
- ð¦¹ð»ââï¸ Good support for dark mode (Thanks to QT).
- ð First class Typescript support. (Works on regular JS projects too ð).
Getting Started
- Check out react-nodegui-starter to get up and running with your own React NodeGUI app!
- Read through the docs
Community Guides
-
https://gregbenner.life/node-gui-react-component-by-component/ - An awesome intro to all base components in react nodegui
-
https://blog.logrocket.com/electron-alternatives-exploring-nodegui-and-react-nodegui/ - Electron alternatives: Exploring NodeGUI and React NodeGUI by Siegfried Grimbeek.
Talks/Podcasts
-
NodeGui and React NodeGui at KarmaJS Nov 2019 meetup: https://www.youtube.com/watch?v=8jH5gaEEDv4
-
JS Party 96: Performant Node desktop apps with NodeGUI â Listen on Changelog.com
Docs for contributing
Looking to contribute? If you wish to implement a new widget/add more features and need help understanding the codebase. You can start here:
Contributing developer docs link:
https://github.com/nodegui/nodegui/tree/master/website/docs/development
Please read: https://github.com/nodegui/.github/blob/master/CONTRIBUTING.md
Building
npm run build
Using custom Qt
QT_INSTALL_DIR=/path/to/qt npm install
npm run build
Updating docs
npm run docs
then followed by:
cd website && GIT_USER=<your_git_username> yarn deploy
Funding
React NodeGUI is an open source project and requires your support. If you like this project, please consider supporting my work by clicking on the sponsor button on this Github repo or via Ko-Fi. Alternatively, Issues on React NodeGui can be funded by anyone via Issuehunt and the amount will be distributed to respective contributors.
Special Thanks
Code of Conduct
https://github.com/nodegui/.github/blob/master/CODE_OF_CONDUCT.md
License
MIT
Maintainers â¨
People maintaining this project.
Atul R |
Contributors â¨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
Top Related Projects
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Build smaller, faster, and more secure desktop applications with a web frontend.
Make any web page a desktop application
:zap: Native, high-performance, cross-platform desktop apps - built with Reason!
A framework for building native Windows apps with React.
Flutter makes it easy and fast to build beautiful apps for mobile and beyond
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot