Installation
Node.js / npm
npm install @cmdop/sdkpnpm
pnpm add @cmdop/sdkYarn
yarn add @cmdop/sdkReact
For React applications:
npm install @cmdop/reactThis includes @cmdop/sdk as a dependency.
Requirements
- Node.js 18.0 or later
- TypeScript 5.0+ (recommended)
API Key
Get your API key from dashboard settings .
Environment Variable
export CMDOP_API_KEY=your-api-keyIn Code
import { Cmdop } from '@cmdop/sdk';
const client = new Cmdop({
apiKey: process.env.CMDOP_API_KEY,
});TypeScript
Full TypeScript support out of the box:
import { Cmdop, Machine, Command } from '@cmdop/sdk';
const client = new Cmdop({ apiKey: '...' });
// Fully typed responses
const machines: Machine[] = await client.machines.list();Browser Usage
The SDK works in browsers with bundlers:
// Next.js, Vite, etc.
import { Cmdop } from '@cmdop/sdk';Note: Never expose your API key in client-side code. Use environment variables or a backend proxy.
Verify Installation
import { Cmdop } from '@cmdop/sdk';
const client = new Cmdop({ apiKey: '...' });
const me = await client.auth.me();
console.log('Authenticated as:', me.email);