dioxus/README.md

107 lines
5.5 KiB
Markdown
Raw Normal View History

2021-01-16 15:31:17 +00:00
<div align="center">
<h1>🌗🚀 Dioxus</h1>
<p>
2021-03-02 06:47:27 +00:00
<strong>Frontend that scales.</strong>
2021-01-16 15:31:17 +00:00
</p>
</div>
2021-03-16 15:03:59 +00:00
<!-- # About -->
2021-01-14 07:56:41 +00:00
Dioxus is a portable, performant, and ergonomic framework for building cross-platform user experiences in Rust.
2021-03-02 06:47:27 +00:00
```rust
2021-03-01 05:16:48 +00:00
static Example: FC<()> = |ctx, props| {
2021-03-26 19:50:28 +00:00
let selection = use_state(&ctx, || "...?");
2021-02-25 23:44:00 +00:00
2021-03-01 05:16:48 +00:00
ctx.render(rsx! {
2021-03-01 02:21:17 +00:00
div {
2021-03-01 05:16:48 +00:00
h1 { "Hello, {selection}" }
2021-03-26 19:50:28 +00:00
button { "?", onclick: move |_| selection.set("world!")}
button { "?", onclick: move |_| selection.set("Dioxus 🎉")}
2021-03-01 02:21:17 +00:00
}
})
};
```
Dioxus can be used to deliver webapps, desktop apps, static pages, liveview apps, Android apps, iOS Apps, and more. At its core, Dioxus is entirely renderer agnostic and has great documentation for creating new renderers for any platform.
2021-03-01 05:16:48 +00:00
### **Things you'll love ❤️:**
2021-03-02 06:47:27 +00:00
- Ergonomic design
2021-03-01 05:16:48 +00:00
- Minimal boilerplate
- Simple build, test, and deploy
2021-03-02 06:47:27 +00:00
- Support for html! and rsx! templating
2021-03-01 05:16:48 +00:00
- SSR, WASM, desktop, and mobile support
2021-03-02 06:47:27 +00:00
- Rust! (enums, static types, modules, efficiency)
2021-03-01 05:16:48 +00:00
2021-03-01 05:18:05 +00:00
2021-03-01 05:16:48 +00:00
## Get Started with...
2021-02-08 22:09:21 +00:00
<table style="width:100%" align="center">
<tr >
<th><a href="http://github.com/jkelleyrtp/dioxus">WebApps</a></th>
2021-02-08 22:08:26 +00:00
<th><a href="http://github.com/jkelleyrtp/dioxus">Desktop</a></th>
<th><a href="http://github.com/jkelleyrtp/dioxus">Mobile</a></th>
<th><a href="http://github.com/jkelleyrtp/dioxus">State Management</a></th>
<th><a href="http://github.com/jkelleyrtp/dioxus">Docs</a></th>
2021-02-08 22:09:21 +00:00
<th><a href="http://github.com/jkelleyrtp/dioxus">Tools</a></th>
2021-02-08 22:05:58 +00:00
<tr>
</table>
2021-02-08 22:07:27 +00:00
2021-02-08 22:05:58 +00:00
2021-02-08 16:12:02 +00:00
2021-02-16 06:41:41 +00:00
## Explore
2021-03-01 05:16:48 +00:00
- [**HTML Templates**: Drop in existing HTML5 templates with html! macro](docs/guides/00-index.md)
- [**RSX Templates**: Clean component design with rsx! macro](docs/guides/00-index.md)
2021-02-16 06:43:50 +00:00
- [**Running the examples**: Explore the vast collection of samples, tutorials, and demos](docs/guides/00-index.md)
- [**Building applications**: Use the Dioxus CLI to build and bundle apps for various platforms](docs/guides/01-ssr.md)
- [**Liveview**: Build custom liveview components that simplify datafetching on all platforms](docs/guides/01-ssr.md)
- [**State management**: Easily add powerful state management that comes integrated with Dioxus Core](docs/guides/01-ssr.md)
- [**Concurrency**: Drop in async where it fits and suspend components until new data is ready](docs/guides/01-ssr.md)
2021-03-01 05:16:48 +00:00
- [**1st party hooks**: Cross-platform router hook](docs/guides/01-ssr.md)
2021-02-16 06:43:50 +00:00
- [**Community hooks**: 3D renderers](docs/guides/01-ssr.md)
2021-01-29 16:57:52 +00:00
2021-03-01 05:16:48 +00:00
---
2021-03-23 18:34:06 +00:00
## Why?
CRUD applications are more complex than ever, requiring knowledge of multiple programming languages on top of annoying build systems and opinionated frameworks. Most JavaScript solutions require libraries to patch core language limitations like Immer for immutable state and TypeScript for static typing.
Certainly, there has to be a better way. Dioxus was made specifically to bring order to this complex ecosystem, taking advantage of immutability-by-default, algebraic datatypes, and efficiency of the Rust programming language. Because Rust runs in both the browser and the server, we can finally write isomoprhic applications that run everywhere, bind to native libraries, and scale well.
Don't be scared of the learning curve - the type of code needed to power a webapp is fairly simple. Diouxs opts to use unsafe (but miri tested!) code to expose an ergonomic API that requires understanding of very few Rust concepts to build a powerful webapp. In many cases, Rust code will end up simpler than JavaScript through the use of immutability, ADTs, and a powerful iterator system that doesn't require annoying "hacks" like `Object.fromEntries`.
## Liveview?
Liveview is an architecture for building web applications where the final page is generated through 3 methods:
- Statically render the bundle.
- Hydrate the bundle to add dynamic functionality.
- Link individual components to the webserver with websockets.
In other frameworks, the DOM will be updated after events from the page are sent to the server and new html is generated. The html is then sent back to the page over websockets (ie html over websockets).
In Dioxus, the user's bundle will link individual components on the page to the Liveview server. This ensures local events propogate through the page virtual dom if the server is not needed, keeping interactive latency low. This ensures the server load stays low, enablinmg a single server to handle tens of thousands of simultaneous clients.
<!-- ## Dioxus LiveHost
2021-03-02 06:47:27 +00:00
Dioxus LiveHost is a paid service that accelerates the deployment of Dioxus Apps. It provides CI/CD, testing, monitoring, scaling, and deployment specifically for Dioxus apps.
2021-03-23 18:34:06 +00:00
- It's the fastest way of launching your next internal tool, side-project, or startup. 🚀 -->
2021-03-02 06:47:27 +00:00
<!-- Dioxus LiveHost is a paid service dedicated to hosting your Dioxus Apps - whether they be server-rendered, wasm-only, or a liveview. It's -->
2021-01-29 16:57:52 +00:00
2021-03-02 06:47:27 +00:00
<!-- LiveHost enables a wide set of features: -->
<!--
2021-02-08 16:12:02 +00:00
- Versioned combined frontend and backend with unique access links
- Builtin CI/CD for all supported Dioxus platforms (macOS, Windows, Android, iOS, server, WASM, etc)
- Managed and pluggable storage database backends (PostgresSQL, Redis)
2021-01-29 16:57:52 +00:00
- Serverless support for minimal latency
- Analytics
- Lighthouse optimization
- On-premise support (see license terms)
2021-02-03 07:26:04 +00:00
- Cloudfare/DDoS protection integrations
2021-02-08 16:12:02 +00:00
- Web-based simulators for iOS, Android, Desktop
2021-03-02 06:47:27 +00:00
- Team + company management -->
2021-01-29 16:57:52 +00:00
2021-03-02 06:47:27 +00:00
<!-- For small teams, LiveHost is free 🎉. Check out the pricing page to see if Dioxus LiveHost is good fit for your team. -->