Building Apps
Build JavaScript and React apps that embed directly into the Flowgear Console to create rich user experiences. Apps run in an iframe at https://app.flowgear.net and all data access goes through Flowgear Workflows via the SDK.
Flowgear Apps invoke native and Site-specific APIs through the current user's security context. This lets the web app stay mostly front-end while Workflows provide business logic and data access.
Use cases you might build:
- Custom dashboards for your integrations
- Utilities to diagnose and resolve integration errors
- Office administrative apps
The sample app repository can be reached at Flowgear Sample App or from your console at: https://app.flowgear.net/#t-{tenantKey}/apps (Settings → Manage Apps → Clone a Sample App).
Warning: Published apps are stored on a publicly accessible blob. Anyone with the URL can access the bundle, so treat it as public. When invoking Workflows, use Cookie-based API Keys tied to the user, not Token-based keys, to avoid unauthorized execution.
Requirements
- Node.js and npm (download)
- Visual Studio Code (or another editor)
- Git (if cloning the sample)
- Flowgear permissions:
- To publish an App:
app-publisheroraccount-administrator - To add an App to a Site:
site-administrator - To invoke Workflows: create an API Key of type Cookie and assign users and Workflows per environment
- To publish an App:
- Valid Flowgear environment hostname configured (Settings → Site settings → Environments → Allowed Origins / Host names)
- NPM packages used by the sample (installed via
npm install):- React 19 + React DOM 19
- Vite 7, TypeScript 5.9,
@vitejs/plugin-react,@vitejs/plugin-basic-ssl flowgear-webapp(Flowgear SDK), Bootstrap 5.3, Sass
Optional helper: Codex AI
- Use ChatGPT Codex (CLI or VS Code extension) for “vibe coding” with the project automation guidance in
AGENTS.md. - Open
AGENTS.mdto give Codex the Flowgear-specific rules (always callFlowgear.Sdk.invokewith relative URLs, etc.). - Codex can read
openapi.ymlto discover available endpoints; download that file from the Cookie-based API Key detail page in the console and place it in the repo root.
Run the sample app
- Clone the Flowgear Sample App repository.
- Run
npm installin the project directory. - Ensure your Site has a Workflow with an API Binding (reach out to support if your domain is not configured). Use relative paths that match the HTTP Binding when invoking.
- Add a Variable Bar with
FgResponseBodyand sample data such as:[ { "Id": 325, "Description": "Order A1455", "Status": "shipped", "OrderNumber": "A1455", "OrderDate": "2023-10-26", "OrderTotal": 500.23 }, { "Id": 328, "Description": "Order A1458", "Status": "placed", "OrderNumber": "A1458", "OrderDate": "2023-10-27", "OrderTotal": 260.5 } ] - Add
FgResponseCode=200andFgResponseContentType=application/json, then save the Workflow. - Create an API Key of Type Cookie, assign the allowed users and Workflows per environment.
- Create
.env.localin the project root with at least:
Optional overrides:FG_DEV_TENANT=yourTenantKey FG_DEV_SITE=yourSiteKeyFG_DEV_PROTOCOL(httpsdefault),FG_DEV_HOST(localhost),FG_DEV_PORT(3000). - Run the dev server:
npm run dev - The dev server uses a self-signed cert via
@vitejs/plugin-basic-ssl. Two tabs auto-open:- Local app URL (accept/trust the certificate here first).
- Flowgear Console debug URL:
https://app.flowgear.net/#t-{tenant}/sites/{site}/apps/debug/?debugUrl={encoded-local-url}.
- If the app does not load immediately in the console, refresh after trusting the cert.
Building your own app
We recommend starting from the sample, but you can bootstrap a new project with Vite + React + TypeScript if preferred:
npm create vite@latest my-directory -- --template react-ts
Set base: './' in vite.config.* and add @vitejs/plugin-basic-ssl if you need HTTPS locally.
Initializing the app
Install the Flowgear SDK:
npm i flowgear-webapp
In src/main.tsx or src/index.tsx (entry point), register with the console before rendering:
import { Flowgear } from 'flowgear-webapp';
Flowgear.Sdk.init();
Using the SDK
init()configures messaging between the iframe and the console.invoke(method, relativeUrl, payload?, headers?, tenant?)calls published Flowgear Workflows. Use the HTTP method and relative URL from your HTTP Binding (do not include the base host). No manual auth headers are needed.- UI helpers:
confirmModal,getTextModal,setAlert,openUrl. - If you hit CORS issues, ensure the environment hostname is listed in Allowed Origins/Hostnames for the Environment.
Debugging in the console
Use the Flowgear debug URL (with your tenant and site keys):
https://app.flowgear.net/#t-{tenantKey}/sites/{siteKey}/apps/debug/?debugUrl={encoded-local-url}
The sample’s dev server opens this automatically when FG_DEV_TENANT and FG_DEV_SITE are set.
Publishing your app
- Prepare
public/app.json(manifest). Example:{ "Name": "SampleApp", "Version": "1.0.0.0", "DisplayName": "Sample App", "Rank": 1 }Namemust be globally unique (e.g.,your-company.your-app).- Increment
Versionevery publish. Rankcontrols embed order within the console.
- Add
public/icon.svg(menu + focus icon). - Build:
npm run build - Zip the
distdirectory contents (Vite output). - In Flowgear:
Settings → Manage Apps → + Publish App, pick the account, upload the ZIP, submit. - After publish, open the app entry, add target Sites, and refresh the console to see it embedded.