app-anything GitHub

Port your first app

This tutorial ports a small Python HTTP app into an app-anything package and builds it for the web. It takes about ten minutes. Every command below is executed by the repository's test suite against examples/python-http, so the tutorial cannot silently rot.

0. Install

$ app-anything --version

1. Start from a copy of the example

Work on a copy of the reference app, and drop its manifest so init can detect from scratch:

$ cp -r examples/python-http my-first-port
$ cd my-first-port
$ rm -rf app-anything

2. Create the manifest

init runs the detectors and asks what it could not detect:

$ app-anything init --answer id=acme.firstport --answer name="First Port" --answer version=0.1.0 .

It writes app-anything/manifest.json. Open it: the backend entry, the health path and the lock file were detected from the project files, the identity came from your answers. Identity is yours to decide — a good id is reverse-DNS (acme.firstport), and it is permanent once users have installed a package.

3. Check until clean

$ app-anything check .

Every finding names a rule (AA101 and friends). When one is unclear:

$ app-anything explain AA205

explain prints the rationale, the fix and the contract clause — the same text on every machine, generated from the catalogue.

4. Run it under the contract

$ app-anything probe .

The probe starts the backend exactly as a host will: chosen port, health poll, token handshake, and a stop on stdin close. It reports, in one line each, whether the backend came up, answered health, performed the handshake, opened a browser, wrote outside its sandbox, left orphans behind or flooded stdout. Fix what it names; the recipe in skills/app-anything-port/references/python-http.md shows the conformant shape.

5. Confirm the targets you want

The web creator serves static frontends — it cannot host a process backend. The check says so before any build work happens:

$ app-anything check --target web .  # expects: 1

Read the refusal: AA601 names the capability no web creator offers (backend.process). This is the capability model working, not a failure to fix in the app: a backend app needs a host that runs it. The desktop does:

$ app-anything check --target macos .

Before building, see what the machine can do:

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

6. Pack

$ app-anything pack .

pack re-runs the checks as a gate, builds the frontend, collects the backend with its lock file, and writes dist/acme.firstport-0.1.0.aapkg. The .aapkg is a directory: open aapkg.json, read reports/check.json. It is the same package every creator consumes.

7. Create the artifact

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

With the Rust toolchain installed this builds a Tauri bundle around your backend. Without it, the command exits 3 — an environment gap, not an app problem; doctor said so first, and installing the toolchain is the whole fix. On a machine with Rust, re-run it and the bundle lands in dist/.

What you learned

The loop is always the same: init → check → probe → check --target → pack → create, fixing by rule ID using explain. The tool carries the knowledge; you carry the decisions. Continue with build for the web and desktop from one package.

Rendered from docs/tutorials/port-your-first-app.md on main.