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
| Field | Type | Default | Description |
|---|---|---|---|
username | string | 'root' | SSH username for admin access |
password | string? | — | Optional password authentication |
publicKeyPath | string | '~/.ssh/nodevisor_id_ed25519.pub' | Path to SSH public key |
privateKeyPath | string | '~/.ssh/nodevisor_id_ed25519' | Path to SSH private key |
passphrase | string? | — | 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
| Field | Type | Default | Description |
|---|---|---|---|
username | string | 'runner' | SSH username for the deploy user |
publicKeyPath | string | '~/.ssh/nodevisor_id_ed25519.pub' | Path to SSH public key |
privateKeyPath | string | '~/.ssh/nodevisor_id_ed25519' | Path to SSH private key |
passphrase | string? | — | 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);
Related Packages
@nodevisor/cli— Uses schemas for CLI input validation@nodevisor/cluster— ClusterUser accepts schema-validated config