Nodevisor Docs
Packages

@nodevisor/schema

Zod validation schemas for admin and runner user configuration with sensible defaults.

Install

npm install @nodevisor/schema

Provides Zod schemas for validating and applying defaults to user configuration objects. Used internally by the CLI and cluster packages to ensure SSH credentials and usernames are properly configured.

Requires zod >= 4 as a peer dependency.


adminSchema

Validates configuration for the admin user (typically root) who performs initial server setup.

import { adminSchema } from '@nodevisor/schema';

// Parse with all defaults
const admin = adminSchema.parse({});
// {
//   username: 'root',
//   password: undefined,
//   publicKeyPath: '~/.ssh/nodevisor_id_ed25519.pub',
//   privateKeyPath: '~/.ssh/nodevisor_id_ed25519',
//   passphrase: undefined,
// }

// Parse with overrides
const custom = adminSchema.parse({
  username: 'admin',
  privateKeyPath: '~/.ssh/id_ed25519',
  publicKeyPath: '~/.ssh/id_ed25519.pub',
  passphrase: 'my-passphrase',
});

Fields

FieldTypeDefaultDescription
usernamestring'root'SSH username for admin access
passwordstring?Optional password authentication
publicKeyPathstring'~/.ssh/nodevisor_id_ed25519.pub'Path to SSH public key
privateKeyPathstring'~/.ssh/nodevisor_id_ed25519'Path to SSH private key
passphrasestring?Passphrase for the private key

runnerSchema

Validates configuration for the deploy/runner user — a non-root user created during setup that handles deployments.

import { runnerSchema } from '@nodevisor/schema';

// Parse with all defaults
const runner = runnerSchema.parse({});
// {
//   username: 'runner',
//   publicKeyPath: '~/.ssh/nodevisor_id_ed25519.pub',
//   privateKeyPath: '~/.ssh/nodevisor_id_ed25519',
//   passphrase: undefined,
// }

// Custom runner username
const deploy = runnerSchema.parse({ username: 'deploy' });

Fields

FieldTypeDefaultDescription
usernamestring'runner'SSH username for the deploy user
publicKeyPathstring'~/.ssh/nodevisor_id_ed25519.pub'Path to SSH public key
privateKeyPathstring'~/.ssh/nodevisor_id_ed25519'Path to SSH private key
passphrasestring?Passphrase for the private key

Usage with ClusterUser

These schemas match the configuration shape expected by ClusterUser:

import { adminSchema, runnerSchema } from '@nodevisor/schema';
import { ClusterUser } from '@nodevisor/cluster';

const adminConfig = adminSchema.parse({ password: process.env.ROOT_PASSWORD });
const runnerConfig = runnerSchema.parse({});

const admin = new ClusterUser(adminConfig);
const runner = new ClusterUser(runnerConfig);

On this page