Total.js Flow Documentation

repository·master·Indexed 20 days ago

https://github.com/totaljs/flow

A platform providing workflow and automation capabilities available via cloud services, Docker, or local installation. Version 11.0.0 includes the FlowStream editor, support for custom extensions, and a Bookmarks plugin API for managing system preferences. It can be deployed using Node.js, Docker, or Docker Compose with configurable startup options via F.run().

Tokens
1.7K
Snippets
10
Records
12
Agent score
69%

What's inside Total.js Flow

  1. Install Total.js Flow locally

    master

    To run Total.js Flow on your local machine, ensure you have Node.js installed. Follow these steps:

    1. Download the Flow source code.
    2. Open your terminal and navigate to the project directory:
      cd flow
    3. Install dependencies:
      npm install
    cd flow
    npm install
  2. Run Total.js Flow in Docker

    master

    You can deploy Total.js Flow using Docker by pulling the official image and running it with port mapping. By default, the application listens on port 8000.

    docker pull totalplatform/flow
    docker run -p 8000:8000 totalplatform/flow
  3. Run Total.js Flow locally

    master

    After installation, you can start Total.js Flow using one of two methods:

    Using npm (Recommended):

    npm run start

    Using the Node.js executable directly: You can specify an optional port. If no port is provided, it defaults to 8000.

    node index.js <port>
    npm run start
    # OR
    node index.js 8000
  4. Install a Flow extension

    master

    To install a Flow extension, copy the extension files (e.g., test.html) into the /extensions/ directory of your Flow installation. These extensions are designed to extend the FlowStream editor functionality.

    # Example: Copying an extension file to the extensions folder
    cp test.html /path/to/flow/extensions/
  5. Start Total.js Flow application

    master

    To start the Total.js Flow application, you must require the total5 package and call F.run(options). The options object allows you to configure the application environment, including release mode and service mode via command line arguments.

    require('total5');
    
    const options = {
      release: process.argv.includes('--release'),
      servicemode: process.argv.includes('--service') || process.argv.includes('--servicemode')
    };
    
    F.run(options);
  6. Run Total.js Flow using Docker Compose

    master

    You can deploy Total.js Flow using Docker Compose. The service is named flow and maps port 8000 on the host to port 8000 in the container.

    To ensure data persistence across container restarts, the following volumes must be configured:

    • databases: Maps to /www/.src/databases/ inside the container to persist database files.
    • flowstream: Maps to /www/.src/flowstream/ inside the container to persist flow stream data.
    services:
      flow:
        container_name: flow
        build: .
        ports:
          - "8000:8000"
        volumes:
          - databases:/www/.src/databases/
          - flowstream:/www/.src/flowstream/
    volumes:
      databases:
      flowstream:
  7. Use the Bookmarks plugin API

    master

    The Bookmarks plugin provides a set of API actions for managing a list of bookmarks stored in PREF.bookmarks. These actions can be called via the +API route.

    Permissions: Access to these actions requires the bookmarks permission. The plugin is visible to users with sa (Super Admin) status or those possessing the bookmarks permission.

    Data Model: A bookmark object typically includes:

    • id: Unique identifier (generated via UID())
    • name: String
    • note: String
    • url: String
    • icon: Icon type
    • color: Color type
    • group: String
    • dtcreated: Timestamp (generated via NOW)
  8. Configure Total.js Flow startup options

    master

    When calling F.run(options), you can pass several configuration keys to control the application behavior:

    OptionDescription
    releaseBoolean. Set to true to run in release mode.
    servicemodeBoolean or String. Enables service mode. If a string, it can specify modes like 'definitions,modules,config'.
    ipString. The IP address to bind to.
    portNumber. The port to listen on.
    unixsocketString. Path to the Unix socket file.
    unixsocket777Boolean. If true, sets Unix socket permissions to 777.
    configObject. Configuration object, e.g., { name: 'Total.js' }.
    sleepNumber. Milliseconds to sleep during startup.
    inspectorNumber. Port for the inspector.
    watchArray of strings. Directories to watch.
    livereloadString. URL for livereload.
    watcherBoolean. Enables the watcher (typically for release mode).
    editString. WebSocket URL for code editing.
    clusterString. Cluster mode setting (e.g., 'auto').
    limitNumber. Max number of threads (used with cluster: 'auto').
    tzString. Timezone setting (e.g., 'utc').
  9. Create a new bookmark via Bookmarks|create

    master

    Create a new bookmark entry. The following fields are required (marked with * in the input schema):

    • name: String
    • url: String

    Optional fields:

    • note: String
    • icon: Icon
    • color: Color
    • group: String

    The action automatically assigns a unique id and a creation timestamp dtcreated.

    /* Action Name: Bookmarks|create */
    /* Route: +API ? */
    /* Input: *name:String, note:String, *url:String, icon:Icon, color:Color, group:String */
  10. Update an existing bookmark via Bookmarks|update

    master

    Update the properties of an existing bookmark. The id is a required field to identify the bookmark to be updated.

    Required field:

    • id: String

    Other fields (optional):

    • name, note, url, icon, color, group
    /* Action Name: Bookmarks|update */
    /* Route: +API ? */
    /* Input: *id:String, *name:String, note:String, *url:String, icon:Icon, color:Color, group:String */