NylorunDocsBeta
Management APIAdmin SDK

Connect

Point the Admin SDK at a Tenant with a management key.

import { createAdmin } from "@nylorun/admin";

const admin = createAdmin(); // options, environment, then the local Tenant

const deployed = createAdmin({
  url: process.env.NYLORUN_RUNTIME_URL!,
  key: process.env.NYLORUN_MANAGEMENT_KEY!,
});

createAdmin() resolves the URL and the management key once, in this order:

  1. Explicit { url, key }, both or neither
  2. NYLORUN_RUNTIME_URL and NYLORUN_MANAGEMENT_KEY
  3. The local Tenant: the project link and the project-management key that nylorun start wrote

NYLORUN_RUNTIME_URL without NYLORUN_MANAGEMENT_KEY is an app's connection, so it does not select step 2. admin.source says which step was used (options, environment, or local-host).

When none resolves, createAdmin() throws connection_missing and lists what it tried. The first request checks the Runtime's /health and throws incompatible_host unless it serves protocol 8.

Options

OptionTypePurpose
urlstringThe Tenant's URL
keystringA management key
tenantstringThe local Tenant to read, instead of the project link's
cwdstringWhere to look for the project link. Default: the working directory

Management keys

Only the Tenant's machine issues management keys. No API call creates one.

Where the Tenant runsCommand
Local Tenantnpx nylorun key put <id> --management
Self-hosted Runtime containernylorun-operate keys put <id> --role management

A management key acts as itself, never for a person. It can issue application keys, but never another management key.

On this page