Installation
SDK Installation
Install the CyberPod SDK from GitHub:
- npm
- pnpm
- yarn
npm install github:ZySec-AI/cpod-apps-sdk#develop
pnpm add github:ZySec-AI/cpod-apps-sdk#develop
yarn add github:ZySec-AI/cpod-apps-sdk#develop
Future npm Release
Once published to npm, you'll be able to install with:
npm install @cpod/sdk
Breaking Change (v0.2.0)
SDK now uses /v1/apps/* paths internally. For current backends, you must enable the path adapter:
initSDK({
baseUrl: "...",
apiKey: "...",
enablePathAdapter: true, // Required for current backends
});
Or set the environment variable: CPOD_ENABLE_PATH_ADAPTER=true
See the Path Adapter guide for details.
CLI Installation
Install the CLI globally to scaffold and bundle CyberPod apps:
npm install -g @cpod/cli
Or use with npx (no install needed):
npx @cpod/cli create my-app
Verify CLI Installation
cpod-apps --version
cpod-apps doctor
Requirements
- Node.js 18.0 or later
- TypeScript 5.0+ (recommended)
Environment Setup
Create a .env file in your project root:
# Required
NEXT_PUBLIC_CPOD_BASE_URL=https://api.cyberpod.ai
# For API Key authentication (recommended for server-side)
CPOD_API_KEY=your-api-key-here
# For Username/Password authentication (alternative)
CPOD_USERNAME=user@example.com
CPOD_PASSWORD=your-password
# Optional: Enable path adapter for legacy endpoints (default: false)
# CPOD_ENABLE_PATH_ADAPTER=true
Framework Integration
Next.js
lib/cpod.ts
import { initSDK } from "@cpod/sdk";
// Initialize once at app startup with API key
initSDK({
baseUrl: process.env.NEXT_PUBLIC_CPOD_BASE_URL!,
apiKey: process.env.CPOD_API_KEY!,
enablePathAdapter: true, // Required for current backends
});
app/layout.tsx
import "@/lib/cpod"; // Import to initialize
export default function RootLayout({ children }) {
return <html>{children}</html>;
}
Express / Node.js
src/index.ts
import { initSDK } from "@cpod/sdk";
import express from "express";
// Initialize SDK with API key
initSDK({
baseUrl: process.env.NEXT_PUBLIC_CPOD_BASE_URL!,
apiKey: process.env.CPOD_API_KEY!,
enablePathAdapter: true, // Required for current backends
});
const app = express();
// ... your routes
Verifying Installation
import { initSDK, getUser } from "@cpod/sdk";
initSDK({
baseUrl: "https://api.cyberpod.ai",
apiKey: process.env.CPOD_API_KEY!,
enablePathAdapter: true, // Required for current backends
});
// Test the connection
try {
const user = await getUser();
console.log("Connected!", user.email);
} catch (error) {
console.error("Connection failed:", error.message);
}