# `mix mob.new`
[🔗](https://github.com/genericjam/mob_new/blob/master/lib/mix/tasks/mob.new.ex#L1)

Creates a new Mob project with Android and iOS boilerplate.

    mix mob.new APP_NAME [--liveview] [--python] [--ios | --android] [--no-install] [--dest DIR] [--local]

## Platform selection

By default the generator emits boilerplate for both Android and iOS. Pass
one of the platform flags to scope it to a single platform:

    mix mob.new my_app --ios        # iOS only — no android/ directory generated
    mix mob.new my_app --android    # Android only — no ios/ directory generated
    mix mob.new my_app              # both (default)

`--no-ios` and `--no-android` are equivalent inverse forms (kept for
back-compat). `mix mob.install`, `mix mob.deploy`, and `mix mob.doctor`
detect the project's platform set from on-disk layout, so a single-platform
project skips the absent platform's setup automatically.

## Options

  * `--liveview`     — generate a Phoenix LiveView app wrapped in a Mob WebView.
                       Calls `mix phx.new` to scaffold a Phoenix project, then
                       adds the Mob native boilerplate and LiveView bridge patches
                       (MobHook in app.js, mob-bridge element in root.html.heex,
                       MobScreen, mob.exs with liveview_port). Requires
                       `phx_new` archive to be installed (`mix archive.install hex phx_new`).
  * `--ios`          — generate iOS boilerplate only (skip android/)
  * `--android`      — generate Android boilerplate only (skip ios/)
  * `--no-ios`       — alias for `--android` (skip iOS boilerplate)
  * `--no-android`   — alias for `--ios` (skip Android boilerplate)
  * `--python`       — pre-configure embedded CPython via Pythonx (iOS only).
                       Adds `:pythonx` to deps, generates a
                       `<App>.PythonPaths` detection module, and gates
                       `:pythonx, :uv_init` in `config.exs` on
                       `MOB_TARGET=ios`. Mirrors `mix mob.enable pythonx`
                       post-scaffold. Bundle size ~70 MB; iOS only —
                       Android Python is intentionally out of scope. See
                       the `Embedded CPython` guide in mob_dev's docs.
  * `--no-install`   — skip running `mix deps.get` after generation
  * `--dest DIR`     — create project in DIR (default: current directory)
  * `--local`        — use `path:` deps pointing to local mob/mob_dev repos
                       instead of hex version constraints, AND render from
                       the local mob_new checkout's templates (not the
                       installed archive's, which can be stale relative to
                       master). **For Mob framework contributors only** —
                       not intended for app developers.

                       Mob paths resolved from `MOB_DIR` / `MOB_DEV_DIR`
                       env vars, falling back to `./mob` / `./mob_dev`,
                       then `../mob` / `../mob_dev`. mob_new template path
                       resolved from `MOB_NEW_DIR`, falling back to
                       `$HOME/code/mob_new`. Pre-fills `mob.exs` so
                       `mix mob.install` skips path configuration prompts.

                       If the local mob_new checkout can't be found, falls
                       back to the installed archive's templates and notes
                       it in the build output.

## What gets generated (native mode, default)

    APP_NAME/
      mix.exs
      lib/APP_NAME/app.ex
      lib/APP_NAME/home_screen.ex
      android/
        settings.gradle
        build.gradle
        app/
          build.gradle
          src/main/
            AndroidManifest.xml
            java/com/mob/APP_NAME/MainActivity.kt
            java/com/mob/APP_NAME/MobBridge.kt
            java/com/mob/APP_NAME/MobNode.kt
            java/com/mob/APP_NAME/MobScannerActivity.kt
        gradle.properties
      ios/
        beam_main.m
        Info.plist

## What gets generated (--liveview mode)

Everything `mix phx.new APP_NAME --no-install` generates, plus:

    APP_NAME/
      lib/APP_NAME/mob_screen.ex      # Mob.Screen wrapping the Phoenix WebView
      mob.exs                          # Mob config with liveview_port: 4000
      android/                         # same Android boilerplate as native mode
      ios/                             # same iOS boilerplate as native mode

Patches applied to the Phoenix project:
  - `assets/js/app.js`                — MobHook definition + registration
  - `lib/APP_NAME_web/.../root.html.heex` — mob-bridge hidden div
  - `lib/APP_NAME/application.ex`     — Mob.App child in supervision tree
  - `mix.exs`                          — mob / mob_dev deps added

After generation, run:

    cd APP_NAME
    mix mob.install    # icon generation + any first-run setup

---

*Consult [api-reference.md](api-reference.md) for complete listing*
