-
Notifications
You must be signed in to change notification settings - Fork 0
Quick Start
This walks you from zero to a running app, then to an installable APK.
paf create myapp
cd myappThis scaffolds:
myapp/
├── enpaf.json # project config (name, package, permissions, ...)
├── main.py # Python entry point
└── app/ # your web UI
├── index.html
├── css/style.css
└── js/app.js
You can choose the Android package name up front:
paf create myapp --package com.acme.myappIf omitted, the package defaults to com.enpaf.<name>.
paf runOpen http://127.0.0.1:8080. The dev server (Flask + Socket.IO) serves your
app/ folder, injects the ENPAF JS bridge, and live-reloads on changes. A
settings panel is available at /enpaf-settings.
Useful flags:
paf run --port 3000 # custom port
paf run --no-browser # don't auto-open the browser
paf run --debug # verbose / debug modemain.py
from enpaf import EnpafApp
app = EnpafApp(__name__)
@app.route("/")
def index():
return app.render("index.html", title=app.name)
@app.bridge_handler("add")
def add(params):
return {"sum": float(params.get("a", 0)) + float(params.get("b", 0))}
@app.on("app_start")
def on_start():
print("App started!")
if __name__ == "__main__":
app.run()app/js/app.js
async function calc() {
const res = await enpaf.call("add", { a: 2, b: 3 });
enpaf.device.toast("2 + 3 = " + res.sum);
}
enpaf.ready(() => console.log("bridge ready"));The enpaf object is injected automatically — no <script> import needed for
the bridge itself (ENPAF adds it into your <head>).
@app.bridge_handler("save_note")
def save_note(params):
notes = app.storage.collection("notes")
return {"id": notes.add({"text": params["text"]})}
@app.bridge_handler("get_notes")
def get_notes(params):
return {"notes": app.storage.collection("notes").all()}Storage is SQLite-backed and works identically in dev and on-device. See Storage.
Make sure the build toolchain is installed, then:
paf build apk # debug build (auto-signed, installable)
paf build apk --release # release build (signed, optimized)The APK lands in dist/<name>-<version>.apk. Install it:
adb install dist/myapp-1.0.0.apk…or transfer the file to your phone and tap it.
Tip: use the Companion app +
paf serveto push builds to a device over Wi-Fi without a cable.
paf doctor # verifies JDK + Android SDK
paf info # prints the current project's configNext: Project Structure and the CLI Reference.
Getting started
Reference
- CLI Reference
- enpaf.json Configuration
- Python API
- JavaScript Bridge
- Storage
- Events
- Device Capabilities
Building & shipping
Project