Skip to content

Polyglot Development (Node/TypeScript, Python & PHP) ​

Build TPF applications in Node/TypeScript, Python, or PHP without re-implementing TPF's execution shell and without installing a JDK, Maven, or Docker for local development.

TPF executes every polyglot pipeline on one Java execution engine paired with thin foreign function hosts and a standalone native tpf CLI. Your TypeScript, Python, or PHP code implements pure typed business functions and, when needed, provider-specific custom Connector adapters. TPF owns graph sequencing, streaming backpressure, deterministic split/merge lineage, retries, telemetry, durable Await suspension and resume, Command reconciliation, and Query capture/replay.

How the boundary works ​

Every polyglot application starts from the same canonical v3 pipeline.yaml contract:

  • Canonical types are the authority: Types declared under types: compile into META-INF/pipeline/pipeline-contract.json and thin language bindings (types.ts / host.ts for TypeScript, types.py / host.py for Python, types.php / host.php for PHP).
  • Exact numeric precision across languages: int64 and decimal values never pass through IEEE-754 floating-point conversions. TypeScript maps int64 to bigint and decimal to exact strings serialised via JSON.rawJSON (Node 22+); Python maps int64 to int and decimal to decimal.Decimal; PHP (64-bit, 8.2+) maps int64 to native 64-bit int and decimal to exact base-10 strings serialised directly as raw JSON number tokens.
  • All four cardinalities are supported: ONE_TO_ONE, ONE_TO_MANY, MANY_TO_ONE, and full-duplex MANY_TO_MANY streams execute over authenticated HTTP/1.1 using canonical JSON and newline-delimited JSON (NDJSON) with explicit completion sentinels.
  • Strict secret isolation: Pure business functions never receive provider credentials, resolved connections, or durable stores. Credentials belong to the host engine (Tier 1) or are delivered selectively to authenticated custom Connector hosts (Tier 2).

Example canonical pipeline.yaml ​

yaml
version: 3
appName: "Invoice Pipeline"
basePackage: "com.example.invoices"
transport: "LOCAL"
platform: "COMPUTE"

types:
  Invoice:
    fields:
      - name: invoiceId
        type: string
      - name: sequenceNumber
        type: int64
      - name: amount
        type: decimal
  LineItem:
    fields:
      - name: sku
        type: string
      - name: lineTotal
        type: decimal
  InvoiceSummary:
    fields:
      - name: invoiceId
        type: string
      - name: grandTotal
        type: decimal

steps:
  - name: "Validate Invoice"
    cardinality: "ONE_TO_ONE"
    input: "Invoice"
    output: "Invoice"
  - name: "Expand Lines"
    cardinality: "ONE_TO_MANY"
    input: "Invoice"
    output: "LineItem"
  - name: "Enrich Lines"
    cardinality: "MANY_TO_MANY"
    input: "LineItem"
    output: "LineItem"
  - name: "Summarise Invoice"
    cardinality: "MANY_TO_ONE"
    input: "LineItem"
    output: "InvoiceSummary"

Reading order ​

  1. Node and TypeScript — generate stubs, author unary/streaming handlers and Tier-2 custom Connectors, and run with Node 22.18+.
  2. Python — generate dataclasses and host stubs, author unary/streaming handlers and Tier-2 custom Connectors, and preserve Decimal precision.
  3. PHP — generate final readonly value classes and a zero-dependency PHP 8.2+ Fiber host with exact int64 and decimal fidelity.
  4. Spring Boot Integration — expose ordinary Spring Boot @Service beans and Tier-2 Connectors over ADR-0092 with pipelineframework-spring-host-starter (ADR-0094).
  5. Local Development and Testing without a JVM — use tpf generate and tpf dev, unit-test handlers natively, and verify crash recovery across SIGKILL.
  6. Deploying Polyglot Applications — run the Quarkus execution engine alongside remote TLS + HMAC Node, Python, PHP, and Spring Boot foreign hosts and DynamoDB stores.

For the architectural rationale and ownership invariants behind this design, see ADR-0092 and ADR-0094.

Diagram