Getting started

Installation

Install oruntime and configure your TypeScript or JavaScript project.

Installation

Install the package

pnpm add oruntime

Requirements

oruntime is ESM-only. Your project must support modern ECMAScript modules.

package.json
{
  "type": "module"
}

For TypeScript, use a modern module resolution strategy:

tsconfig.json
{
  "compilerOptions": {
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "target": "ES2022",
    "lib": ["ES2022", "DOM"]
  }
}

The package has no runtime dependencies and includes its TypeScript declarations.

Verify the installation

check.ts
import { detectRuntime } from 'oruntime'

console.log(detectRuntime())

Run the file with your runtime:

node check.ts

Main import

All public APIs are exported from the main entry point:

import {
  createRuntimeAdapter,
  detectRuntime,
  detectRuntimeCapabilities,
  fetchJSON,
  runtimeFetch,
  sleep,
  toURL
} from 'oruntime'

Bundlers

oruntime does not load Node modules on startup, so browser and edge bundlers can analyze it. When code may execute in several environments, check capabilities instead of assuming that server APIs exist.