https://github.com/kyleu/generust
A cargo-generate template to help you build your best web application using Rust
https://github.com/kyleu/generust
Last synced: 12 months ago
JSON representation
A cargo-generate template to help you build your best web application using Rust
- Host: GitHub
- URL: https://github.com/kyleu/generust
- Owner: kyleu
- License: mit
- Created: 2019-11-09T17:59:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-12T15:50:17.000Z (over 6 years ago)
- Last Synced: 2025-05-14T11:41:33.009Z (about 1 year ago)
- Language: Rust
- Size: 1.16 MB
- Stars: 15
- Watchers: 2
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Generust
[](License)
## A Rust project template for dynamic web applications
`Generust` is a [cargo-generate](https://github.com/ashleygwilliams/cargo-generate) template that provides a Rust web server and WASM client with some [interesting features](doc/features.md).
It uses [actix-web](https://actix.rs), [maud](https://maud.lambda.xyz), [UIKit](https://getuikit.com), and [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) to serve your app as a server or webview, via HTTP and WebSockets.
Rust nightly is required, at least for now
## Screenshots

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

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

UIKit integration and reverse routing make designing attractive pages simple.

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

Custom error pages show detailed traces (or custom error pages)
## Example Projects
[generust-example-project](https://github.com/kyleu/generust-example-project) - Basically just the result of running this template
## Use `cargo generate` to clone this template and make it your own
```script
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](doc/scripts.md) 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}}
[](https://travis-ci.org/{{project-name}}/{{project-name}})
[](https://crates.io/crates/{{project-name}})
[](https://docs.rs/{{project-name}})
[](https://deps.rs/repo/github/{{project-name}}/{{project-name}})
{{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](doc/installing.md) for installation guidance. After installing, run `{{project-name}} -h` to get started.
See [scripts.md](doc/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