generust icon indicating copy to clipboard operation
generust copied to clipboard

A cargo-generate template to help you build your best web application using Rust

Generust

License

A Rust project template for dynamic web applications

Generust is a cargo-generate template that provides a Rust web server and WASM client with some interesting features.

It uses actix-web, maud, UIKit, and wasm-bindgen to serve your app as a server or webview, via HTTP and WebSockets.

Rust nightly is required, at least for now

Screenshots

Index Page Normally started as a server, Generust also embeds a webview, allowing you to run a standalone instance.

User Profile User profile settings allow you to set your name and theme.

UIKit UIKit integration and reverse routing make designing attractive pages simple.

Dark Mode I don't get it, but some of you love Dark Mode. Well, here it is.

Backtrace Custom error pages show detailed traces (or custom error pages)

Example Projects

generust-example-project - Basically just the result of running this template

Use cargo generate to clone this template and make it your own

cargo install cargo-generate
cargo generate --git https://github.com/kyleu/generust.git --name my-project
cd my-project
./bootstrap

This will package the WASM client, compile the UIKit SCSS, and build the main application. You can execute cargo run to start the server and open a system webview pointing to it, or run {{project-name}} -h to see the CLI options. Scripts are provided in ./bin that will help you build and publish the app.

Good luck!

Your Project

After you've created your project, the variables in this file will be replaced with your project's information, just remove this section and the lines above it.

{{project-name}}

Build Status Crate Docs Dependencies

{{project-name}} is a work in progress...

Running as a client application or shared server, {{project-name}} has a focus on performance, correctness, and developer comfort.

See installing.md for installation guidance. After installing, run {{project-name}} -h to get started.

See scripts.md for available tools for building, running, and packaging the app.

Crates

{{project-name}} splits its code into several library crates:

  • {{project-name}}-assets: Contains embedded static files intended to be served from the web application
  • {{project-name}}-client: Run in the client's browser as a WebAssembly package, includes templates
  • {{project-name}}-controllers: Contains actix-web HTTP controllers, usually calling methods from {{project-name}}-service
  • {{project-name}}-core: Contains definitions that are shared between server and client
  • {{project-name}}-service: Contains the primary logic for the application. It receives RequestMessages and emits ResponseMessages
  • {{project-name}}-templates: Contains Maud templates used by the server to render responses
  • {{project-name}}: Stored in the root of the project, this is the app's main library and binary

Config

The project currently exclusively uses the filesystem for saved data, no database is involved.

Directories

By default, {{project-name}} stores config files in your system's user configuration directory.

  • macOS: ~/Library/Application Support/{{project-name}}
  • Linux: ~/.config/{{project-name}}
  • Windows: %APPDATA%/{{project-name}}/{{project-name}}

Files

profile/*: User profile information