This example uses examples/node/functions/typescript_service/function.py to package a TypeScript service, build it with npm run build, and expose it through a Nullspace service URL.

Setup

python -m pip install "nullspace-sdk[cli]"
export NULLSPACE_API_KEY=ns_live_...
export NULLSPACE_API_URL=https://api.your-nullspace-domain
cd examples/node/functions/typescript_service

CLI

nullspace functions deploy --json

nullspace functions url typescript-function-service

nullspace functions status typescript-function-service --service fnsvc_123
nullspace functions logs typescript-function-service --service fnsvc_123
nullspace functions stop typescript-function-service
The service exposes /health and /invoke.

Function Definition

function.py
import nullspace

function = nullspace.Function(
    "typescript-function-service",
    mode="service",
    install="npm install",
    entrypoint="npm run start",
    service=nullspace.Service(
        port=8000,
        readiness={"type": "http", "path": "/health", "timeout_seconds": 30},
    ),
    policy=nullspace.Policy(public_url=True),
)

Project Files

examples/node/functions/typescript_service/
  README.md
  package.json
  tsconfig.json
  function.py
  src/server.ts
Related: Functions and Preview URLs. For finite work, see the TypeScript job example.