MonetizationOS Docs
Workflows Reference

Overview

Workflows are serverless TypeScript functions that run at the edge, enabling you to extend and customize MonetizationOS with your own business logic. Whether you need to control surface rendering, validate access decisions, dynamically provision plans, respond to platform events, or handle custom HTTP requests, workflows integrate seamlessly at critical points throughout the platform lifecycle.

Workflow Types

Workflow Runtime

  • MonetizationOS workflows are written in TypeScript, providing strong typing and autocompletion for workflow arguments, return types, and platform utilities.
  • Workflows run in a secure, sandboxed environment (V8 isolates) at the edge, ensuring low-latency execution close to your users.
  • The version of V8 (Chrome's JavaScript engine) is updated at least weekly, targeting the latest stable version to incorporate the latest performance, features, and security improvements.
  • Supports all JavaScript language features supported by the latest stable V8 version. See the JavaScript reference for details.
    • For security reasons, certain APIs are restricted or unavailable in the workflow runtime (e.g. eval, Function constructor, and WebAssembly).
  • Supports standard Web APIs available in modern browsers, including:

Workflow Execution Model

  • Action Workflows: Runs in response to triggers; does not block access checks or surface decisions.
  • Component Workflows: Runs during surface decisions, after parent surface workflows.
  • Endpoint Workflows: Runs when HTTP requests hit configured endpoints.
  • Surface Workflows: Runs during surface decisions, before component workflows. Can terminate early with HTTP responses.
  • Feature Workflows: Runs during access checks and surface decisions, after plan-based property resolution.
  • Dynamic Provisioning Workflows: Runs during provisioning phase to assign plans dynamically.