🚀 TUTORIAL: BUILDING AN OFFLINE APP (LOCAL APP) IN FLOWORK OS
PART 1: BASIC CONCEPTS, HOW IT WORKS, & FILE ANATOMY
1. How Does It Work? (Dual-Engine Architecture)
Offline Applications in Flowork OS distinguish themselves from standard web apps by utilizing a Dual-Engine Architecture. This application does not overload your browser's memory (RAM); instead, it uses your own computer as a "Private Server".
Here is the end-to-end workflow:
1. The Client (Web UI): The user clicks the "START" button on the Web interface (`index.html` or `mobile.html`). This button does not execute heavy computation; it triggers a command in `app.js`. 2. P2P Tunnel: `app.js` calls `systemBridge.js`. This script wraps the command into a JSON payload and securely sends it through a direct P2P WebSocket tunnel to the Golang Engine running in the background of the user's PC (`localhost:5000`). 3. The Overseer (Golang): The Golang Engine receives the message, locates the target application folder (e.g., `apps/screen-recorder/`), automatically downloads any required libraries if they are missing, and executes the Python file (`script.py`). 4. Native Executor (Python): Python reads the command via the "STDIN Pipe", processes its heavy tasks (such as file system access, video rendering, or browser-less scraping), and then prints the result back as a JSON string. 5. Cycle Complete: Golang captures Python's printed output and throws it back via P2P to the Web UI. The UI receives the data and displays it to the user. All of this happens in a matter of milliseconds.
2. Folder Anatomy & Absolute File Rules
Every Local Application must be placed inside the `apps/app-name/` directory on your PC Engine.
Flowork is extremely strict about file structure. If a single core file is missing or violates the rules, the OS will refuse to render the application.
Here is the standard template skeleton (using `apps/screen-recorder/` as an example):
```plaintext apps/screen-recorder/ ├── manifest.json # [REQUIRED] App identity. Must include the "is_local": true flag so the OS knows it runs on PC. ├── schema.json # [REQUIRED] Standard I/O (Input/Output) contract between Javascript UI and Python Backend. ├── requirements.txt # [IMPORTANT] Python library list. The Golang Engine will auto-install these into the app's local folder (Portable Mode). ├── script.py # [REQUIRED] The backend computational brain. Where native logic (Python/C++/Node) is executed by Golang. ├── index.html # [REQUIRED] Desktop UI. Must have an Enterprise style. Strictly NO