app-anything GitHub

Build for the web and desktop from one package

This tutorial starts where port your first app ended: you understand the loop. Here you build one package into two artifacts without touching the app — using the static example, because a static frontend is the shape every target accepts.

The commands run in CI against examples/static-site; the desktop build runs only where the Rust toolchain exists, which the commands check first.

1. Prepare the project

$ cd examples/static-site
$ app-anything init --answer id=acme.firstsite --answer name="First Site" --answer version=1.0.0 .
$ app-anything check --target web .

2. Ask the host what it can do

$ app-anything doctor  # expects: 0..1

doctor lists, per creator and target, the host requirements — the web creator needs nothing, the desktop creator needs Rust and the Tauri CLI, and so on. A missing toolchain is exit code 3, an environment problem: install the toolchain rather than debugging around it.

3. Pack once

$ app-anything pack .

One package, dist/acme.firstsite-1.0.0.aapkg, is all any creator ever needs. There is no per-target packing step.

4. Build for the web

$ app-anything create "$PACKAGE" web web

The web creator writes a self-contained static site into dist/. Serve it from any static host.

5. Build for the desktop

The same package, a different creator:

$ app-anything create "$PACKAGE" desktop macos  # expects: 3

On a machine with the toolchain this builds a Tauri bundle: the webview shell with your frontend inside, no backend to supervise this time. Without Rust it exits 3 — doctor said so first.

6. What both builds share

Both builds ran the identical .aapkg — same manifest, same checks report, same frontend. The differences live in the creators, and the explanation of the package covers exactly what travels and what stays.

What you learned

Targets are a creator choice made at create time, not a packaging decision: pack once, create many. A backend app changes nothing about the flow — it merely selects the targets that offer backend.process, which is what the first tutorial demonstrated with the AA601 refusal.

Rendered from docs/tutorials/web-and-desktop-from-one-package.md on main.