PWA & static files

Flow apps ship an installable PWA (manifest + service worker) by default. Static assets can live in public/ instead of include_bytes!.

PWA (on by default)

FlowApp::into_router enables PWA from page title/description and precaches static routes. Opt out:

FlowApp::new()
    .without_pwa()   // or RESUMA_PWA=0 in the environment
    .auto_pages("src/pages", PagesRegistry)
    .serve(FlowServeOptions::default())
    .await

Customize manifest & precache

FlowApp::new()
    .with_pwa(
        FlowPwaConfig::from_page_options("My App", "Tagline", "es", &[])
            .theme("#4f46e5", "#0f172a")
            .shortcut("Book", "Book", "/book")
            .precache_path("/images/hero.jpg"),
    )
    .with_theme_pwa(Theme {
        primary: "#4f46e5".into(),
        background: "#0f172a".into(),
        ..Default::default()
    })

with_theme_pwa copies Theme::primary / background into manifest colors when you do not call .theme(...) explicitly.

Icons from public/

Drop PNGs at standard paths — they override generated SVG icons in the manifest:

  • public/icons/icon-192.png/icons/icon-192.png
  • public/icons/icon-512.png
  • public/icons/icon-maskable.png
  • public/icons/apple-touch-icon.png

The public/ directory

Files under {CARGO_MANIFEST_DIR}/public are served at the same URL path (e.g. public/images/logo.png/images/logo.png). No static_asset boilerplate required. Paths are added to the PWA precache list.

FlowApp::new()
    .with_public_dir("public")   // optional — this is the default root
    .auto_pages("src/pages", PagesRegistry)

Prefer public/ for JPEG/PNG/fonts; keep static_asset for bytes compiled into the binary. See CSP configure for img-src 'self'.

Scaffold: booking app

resuma new my-salon --template flow-booking

Demonstrates query-driven #[load] with loader_refresh_input.