Installation

Install the LegionEdge SDK and set up your development environment

This guide covers installing the @legionedge/sdk package and configuring your environment for LegionEdge Platform development.

System Requirements

  • Node.js 18.0 or later
  • TypeScript 5.0 or later (recommended but not required)
  • Package manager: npm or yarn

Install the SDK

Install the LegionEdge SDK using your preferred package manager:

# npm
npm install @legionedge/sdk

# yarn
yarn add @legionedge/sdk

Optional Peer Dependencies

If you plan to use specific integrations, install the corresponding packages:

# Nokuva AI agent integration
npm install @legionedge/nokuva

# Tovac data context integration
npm install @legionedge/tovac

# Foltrac infrastructure integration
npm install @legionedge/foltrac

Environment Setup

1. Obtain an API Key

Sign in to the LegionEdge Dashboard and navigate to Settings > API Keys to generate a new key. Choose the appropriate scope for your use case:

  • Full Access -- Read and write access to all resources.
  • Read Only -- Read access only, suitable for monitoring and reporting.
  • Project Scoped -- Access limited to a specific project.

2. Configure Environment Variables

Create a .env file at the root of your project:

LEGIONEDGE_API_KEY=le_live_abc123def456
LEGIONEDGE_ORG_ID=org_your_org_id
LEGIONEDGE_ENV=production

3. Verify the Installation

Create a quick test script to confirm everything is working:

import { LegionEdge } from "@legionedge/sdk";

const client = new LegionEdge({
  apiKey: process.env.LEGIONEDGE_API_KEY!,
});

async function verify() {
  const me = await client.auth.whoami();
  console.log("Authenticated as:", me.email);
  console.log("Organization:", me.organizationId);
}

verify().catch(console.error);

Run the script:

npx tsx verify.ts

If successful, you will see your email and organization ID printed to the console.

TypeScript Configuration

The SDK ships with full type definitions. For the best experience, ensure your tsconfig.json includes:

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true,
    "esModuleInterop": true
  }
}

Next Steps