dioxus/examples/pwa
Evan Almloff 20d146d9bd
Simplify the launch builder (#2967)
* improve documentation for the fullstack server context

* Add a section about axum integration to the crate root docs

* make serve_dioxus_application accept the cfg builder directly

* remove unused server_fn module

* improve fullstack config docs

* improve documentation for the server function macro

* fix axum router extension link

* Fix doc tests

* Fix launch builder

* Simplify the launch builder

* don't re-export launch in the prelude

* refactor fullstack launch

* Fix fullstack launch builder

* Update static generation with the new builder api

* fix some formatting/overly broad launch replacements

* fix custom menu example

* fix fullstack/static generation examples

* Fix static generation launch

* A few small formatting fixes

* Fix a few doc tests

* implement LaunchConfig for serve configs

* fix fullstack launch with separate web and server launch methods

* fix check with all features

* dont expose inner core module

* clippy and check

* fix readme

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-10-10 16:00:58 -07:00
..
public Chore: hoist example projects for discoverability (#2959) 2024-09-16 09:11:33 -05:00
src Simplify the launch builder (#2967) 2024-10-10 16:00:58 -07:00
Cargo.toml Chore: hoist example projects for discoverability (#2959) 2024-09-16 09:11:33 -05:00
Dioxus.toml Chore: hoist example projects for discoverability (#2959) 2024-09-16 09:11:33 -05:00
index.html Chore: hoist example projects for discoverability (#2959) 2024-09-16 09:11:33 -05:00
LICENSE Chore: hoist example projects for discoverability (#2959) 2024-09-16 09:11:33 -05:00
README.md Chore: hoist example projects for discoverability (#2959) 2024-09-16 09:11:33 -05:00

Dioxus PWA example

This is a basic example of a progressive web app (PWA) using Dioxus and Dioxus CLI. Currently PWA functionality requires the use of a service worker and manifest file, so this isn't 100% Rust yet.

It is also very much usable as a template for your projects, if you're aiming to create a PWA.

Try the example

Make sure you have Dioxus CLI installed (if you're unsure, run cargo install dioxus-cli --locked).

You can run dx serve in this directory to start the web server locally, or run dx build --release to build the project so you can deploy it on a separate web-server.

Project Structure

├── Cargo.toml
├── Dioxus.toml
├── index.html // Custom HTML is needed for this, to load the SW and manifest.
├── LICENSE
├── public
│   ├── favicon.ico
│   ├── logo_192.png
│   ├── logo_512.png
│   ├── manifest.json // The manifest file - edit this as you need to.
│   └── sw.js // The service worker - you must edit this for actual projects.
├── README.md
└── src
    └── main.rs

Resources

If you're just getting started with PWAs, here are some useful resources:

For service worker scripting (in JavaScript):

If you want to stay as close to 100% Rust as possible, you can try using wasi-worker to replace the JS service worker file. The JSON manifest will still be required though.