Skip to content

Runtime API Examples

This page demonstrates usage of some of the runtime APIs provided by VitePress.

The main useData() API can be used to access site, theme, and page data for the current page. It works in both .md and .vue files:

md
<script setup>
import { useData } from 'vitepress'

const { theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>

Results

Theme Data

{
  "logo": "/logo.svg",
  "nav": [
    {
      "text": "Platform",
      "link": "https://tinysystems.io"
    },
    {
      "text": "Home",
      "link": "/"
    },
    {
      "text": "Introduction",
      "link": "/introduction/what-is-tinysystems"
    },
    {
      "text": "User Guide",
      "link": "/user-guide/getting-started/creating-your-first-flow"
    },
    {
      "text": "Developer Guide",
      "link": "/developer-guide/getting-started/prerequisites"
    },
    {
      "text": "Reference",
      "link": "/reference/api/kubernetes-api"
    },
    {
      "text": "Examples",
      "link": "/examples/components/simple-transformer"
    }
  ],
  "sidebar": {
    "/introduction/": [
      {
        "text": "Introduction",
        "items": [
          {
            "text": "What is TinySystems?",
            "link": "/introduction/what-is-tinysystems"
          },
          {
            "text": "Core Concepts",
            "link": "/introduction/core-concepts"
          },
          {
            "text": "Architecture Overview",
            "link": "/introduction/architecture-overview"
          },
          {
            "text": "Quick Start",
            "link": "/introduction/quick-start"
          }
        ]
      }
    ],
    "/user-guide/": [
      {
        "text": "Getting Started",
        "items": [
          {
            "text": "Creating Your First Flow",
            "link": "/user-guide/getting-started/creating-your-first-flow"
          },
          {
            "text": "Understanding the Editor",
            "link": "/user-guide/getting-started/understanding-the-editor"
          },
          {
            "text": "Running and Debugging",
            "link": "/user-guide/getting-started/running-and-debugging"
          }
        ]
      },
      {
        "text": "Flows",
        "items": [
          {
            "text": "Flow Basics",
            "link": "/user-guide/flows/flow-basics"
          },
          {
            "text": "Nodes and Edges",
            "link": "/user-guide/flows/nodes-and-edges"
          },
          {
            "text": "Data Mapping",
            "link": "/user-guide/flows/data-mapping"
          },
          {
            "text": "Flow Revisions",
            "link": "/user-guide/flows/flow-revisions"
          }
        ]
      },
      {
        "text": "Expressions",
        "items": [
          {
            "text": "Expression Syntax",
            "link": "/user-guide/expressions/expression-syntax"
          },
          {
            "text": "JSONPath Reference",
            "link": "/user-guide/expressions/jsonpath-reference"
          },
          {
            "text": "Operators and Functions",
            "link": "/user-guide/expressions/operators-and-functions"
          },
          {
            "text": "Expression Examples",
            "link": "/user-guide/expressions/expression-examples"
          }
        ]
      },
      {
        "text": "Clusters",
        "items": [
          {
            "text": "Cluster Requirements",
            "link": "/user-guide/clusters/cluster-requirements"
          },
          {
            "text": "Connecting Your Cluster",
            "link": "/user-guide/clusters/connecting-your-cluster"
          },
          {
            "text": "Cluster Management",
            "link": "/user-guide/clusters/cluster-management"
          },
          {
            "text": "Troubleshooting Clusters",
            "link": "/user-guide/clusters/troubleshooting-clusters"
          }
        ]
      },
      {
        "text": "Modules",
        "items": [
          {
            "text": "Installing Modules",
            "link": "/user-guide/modules/installing-modules"
          },
          {
            "text": "Available Modules",
            "link": "/user-guide/modules/available-modules"
          },
          {
            "text": "Module Configuration",
            "link": "/user-guide/modules/module-configuration"
          }
        ]
      },
      {
        "text": "Projects",
        "items": [
          {
            "text": "Organizing Projects",
            "link": "/user-guide/projects/organizing-projects"
          },
          {
            "text": "Workspaces",
            "link": "/user-guide/projects/workspaces"
          }
        ]
      }
    ],
    "/developer-guide/": [
      {
        "text": "Getting Started",
        "items": [
          {
            "text": "Prerequisites",
            "link": "/developer-guide/getting-started/prerequisites"
          },
          {
            "text": "SDK Installation",
            "link": "/developer-guide/getting-started/sdk-installation"
          },
          {
            "text": "Hello World Component",
            "link": "/developer-guide/getting-started/hello-world-component"
          },
          {
            "text": "Project Structure",
            "link": "/developer-guide/getting-started/project-structure"
          }
        ]
      },
      {
        "text": "Core Concepts",
        "items": [
          {
            "text": "Component Model",
            "link": "/developer-guide/core-concepts/component-model"
          },
          {
            "text": "Ports and Messages",
            "link": "/developer-guide/core-concepts/ports-and-messages"
          },
          {
            "text": "Message Flow",
            "link": "/developer-guide/core-concepts/message-flow"
          },
          {
            "text": "Blocking vs Async",
            "link": "/developer-guide/core-concepts/blocking-vs-async"
          },
          {
            "text": "Error Handling",
            "link": "/developer-guide/core-concepts/error-handling"
          }
        ]
      },
      {
        "text": "Components",
        "items": [
          {
            "text": "Component Interface",
            "link": "/developer-guide/components/component-interface"
          },
          {
            "text": "Defining Ports",
            "link": "/developer-guide/components/defining-ports"
          },
          {
            "text": "Handling Messages",
            "link": "/developer-guide/components/handling-messages"
          },
          {
            "text": "Settings and Configuration",
            "link": "/developer-guide/components/settings-and-configuration"
          },
          {
            "text": "Control Ports",
            "link": "/developer-guide/components/control-ports"
          },
          {
            "text": "System Ports",
            "link": "/developer-guide/components/system-ports"
          },
          {
            "text": "Component Patterns",
            "link": "/developer-guide/components/component-patterns"
          }
        ]
      },
      {
        "text": "Schema",
        "items": [
          {
            "text": "JSON Schema Basics",
            "link": "/developer-guide/schema/json-schema-basics"
          },
          {
            "text": "Schema from Go",
            "link": "/developer-guide/schema/schema-from-go"
          },
          {
            "text": "ConfigRef Pattern",
            "link": "/developer-guide/schema/configref-pattern"
          },
          {
            "text": "Dynamic Schemas",
            "link": "/developer-guide/schema/dynamic-schemas"
          },
          {
            "text": "Configurable Overlay",
            "link": "/developer-guide/schema/configurable-overlay"
          }
        ]
      },
      {
        "text": "Expressions",
        "items": [
          {
            "text": "Expression Syntax",
            "link": "/developer-guide/expressions/expression-syntax"
          },
          {
            "text": "Data Transformation",
            "link": "/developer-guide/expressions/data-transformation"
          },
          {
            "text": "Built-in Functions",
            "link": "/developer-guide/expressions/built-in-functions"
          }
        ]
      },
      {
        "text": "Kubernetes",
        "items": [
          {
            "text": "Architecture",
            "link": "/developer-guide/kubernetes/architecture"
          },
          {
            "text": "TinyNode CRD",
            "link": "/developer-guide/kubernetes/tinynode-crd"
          },
          {
            "text": "TinyModule CRD",
            "link": "/developer-guide/kubernetes/tinymodule-crd"
          },
          {
            "text": "TinySignal CRD",
            "link": "/developer-guide/kubernetes/tinysignal-crd"
          },
          {
            "text": "Controller Reconciliation",
            "link": "/developer-guide/kubernetes/controller-reconciliation"
          },
          {
            "text": "Leader Election",
            "link": "/developer-guide/kubernetes/leader-election"
          }
        ]
      },
      {
        "text": "Scalability",
        "items": [
          {
            "text": "Module Discovery",
            "link": "/developer-guide/scalability/module-discovery"
          },
          {
            "text": "CR-Based State Propagation",
            "link": "/developer-guide/scalability/cr-based-state-propagation"
          },
          {
            "text": "Leader-Reader Pattern",
            "link": "/developer-guide/scalability/leader-reader-pattern"
          },
          {
            "text": "Multi-Replica Coordination",
            "link": "/developer-guide/scalability/multi-replica-coordination"
          },
          {
            "text": "Horizontal Scaling",
            "link": "/developer-guide/scalability/horizontal-scaling"
          }
        ]
      },
      {
        "text": "Communication",
        "items": [
          {
            "text": "gRPC Fundamentals",
            "link": "/developer-guide/communication/grpc-fundamentals"
          },
          {
            "text": "Internal Routing",
            "link": "/developer-guide/communication/internal-routing"
          },
          {
            "text": "Cross-Module Communication",
            "link": "/developer-guide/communication/cross-module-communication"
          },
          {
            "text": "Client Pool",
            "link": "/developer-guide/communication/client-pool"
          }
        ]
      },
      {
        "text": "Advanced",
        "items": [
          {
            "text": "Testing Components",
            "link": "/developer-guide/advanced/testing-components"
          },
          {
            "text": "Resource Manager",
            "link": "/developer-guide/advanced/resource-manager"
          },
          {
            "text": "Ingress Exposure",
            "link": "/developer-guide/advanced/ingress-exposure"
          },
          {
            "text": "Observability",
            "link": "/developer-guide/advanced/observability"
          },
          {
            "text": "Debugging",
            "link": "/developer-guide/advanced/debugging"
          },
          {
            "text": "Project JSON Generation",
            "link": "/developer-guide/advanced/project-json-generation"
          }
        ]
      },
      {
        "text": "CLI",
        "items": [
          {
            "text": "CLI Overview",
            "link": "/developer-guide/cli/cli-overview"
          },
          {
            "text": "Development Commands",
            "link": "/developer-guide/cli/development-commands"
          },
          {
            "text": "Module Scaffold",
            "link": "/developer-guide/cli/module-scaffold"
          },
          {
            "text": "Local Testing",
            "link": "/developer-guide/cli/local-testing"
          }
        ]
      },
      {
        "text": "Publishing",
        "items": [
          {
            "text": "Building Modules",
            "link": "/developer-guide/publishing/building-modules"
          },
          {
            "text": "Helm Charts",
            "link": "/developer-guide/publishing/helm-charts"
          },
          {
            "text": "Registry Publishing",
            "link": "/developer-guide/publishing/registry-publishing"
          },
          {
            "text": "Versioning",
            "link": "/developer-guide/publishing/versioning"
          }
        ]
      }
    ],
    "/reference/": [
      {
        "text": "API Reference",
        "items": [
          {
            "text": "Kubernetes API",
            "link": "/reference/api/kubernetes-api"
          },
          {
            "text": "Component Interface",
            "link": "/reference/api/component-interface"
          },
          {
            "text": "Port Interface",
            "link": "/reference/api/port-interface"
          },
          {
            "text": "Handler Interface",
            "link": "/reference/api/handler-interface"
          }
        ]
      },
      {
        "text": "Expressions",
        "items": [
          {
            "text": "Syntax Reference",
            "link": "/reference/expressions/syntax-reference"
          },
          {
            "text": "Operators",
            "link": "/reference/expressions/operators"
          },
          {
            "text": "Built-in Functions",
            "link": "/reference/expressions/built-in-functions"
          }
        ]
      },
      {
        "text": "Struct Tags",
        "items": [
          {
            "text": "Complete Reference",
            "link": "/reference/struct-tags/complete-reference"
          }
        ]
      },
      {
        "text": "System Ports",
        "items": [
          {
            "text": "System Ports Reference",
            "link": "/reference/system-ports/system-ports-reference"
          }
        ]
      }
    ],
    "/examples/": [
      {
        "text": "Component Examples",
        "items": [
          {
            "text": "Simple Transformer",
            "link": "/examples/components/simple-transformer"
          },
          {
            "text": "Conditional Router",
            "link": "/examples/components/conditional-router"
          },
          {
            "text": "Array Iterator",
            "link": "/examples/components/array-iterator"
          },
          {
            "text": "Periodic Emitter",
            "link": "/examples/components/periodic-emitter"
          },
          {
            "text": "HTTP Server",
            "link": "/examples/components/http-server"
          },
          {
            "text": "HTTP Client",
            "link": "/examples/components/http-client"
          },
          {
            "text": "Database Connector",
            "link": "/examples/components/database-connector"
          },
          {
            "text": "Stateful Component",
            "link": "/examples/components/stateful-component"
          }
        ]
      },
      {
        "text": "Flow Examples",
        "items": [
          {
            "text": "Webhook to Slack",
            "link": "/examples/flows/webhook-to-slack"
          },
          {
            "text": "API Integration",
            "link": "/examples/flows/api-integration"
          }
        ]
      }
    ],
    "/appendix/": [
      {
        "text": "Appendix",
        "items": [
          {
            "text": "Glossary",
            "link": "/appendix/glossary"
          },
          {
            "text": "FAQ",
            "link": "/appendix/faq"
          },
          {
            "text": "Migration Guide",
            "link": "/appendix/migration-guide"
          },
          {
            "text": "Changelog",
            "link": "/appendix/changelog"
          }
        ]
      }
    ]
  },
  "search": {
    "provider": "local"
  },
  "editLink": {
    "pattern": "https://github.com/tiny-systems/platform/edit/main/apps/docs/docs/:path",
    "text": "Edit this page on GitHub"
  },
  "socialLinks": [
    {
      "icon": "github",
      "link": "https://github.com/tiny-systems"
    }
  ],
  "footer": {
    "message": "Build flow-based applications on Kubernetes",
    "copyright": "Copyright © TinySystems"
  }
}

Page Data

{
  "title": "Runtime API Examples",
  "description": "",
  "frontmatter": {
    "outline": "deep"
  },
  "headers": [],
  "relativePath": "api-examples.md",
  "filePath": "api-examples.md"
}

Page Frontmatter

{
  "outline": "deep"
}

More

Check out the documentation for the full list of runtime APIs.

Build flow-based applications on Kubernetes