Node.js SDK
The official Node.js SDK for RotaStellar with full TypeScript support, providing access to Planning, Intelligence, and Runtime APIs.Status: Early Access — Request API key
Installation
npm install @rotastellar/sdk
# Yarn
yarn add @rotastellar/sdk
# pnpm
pnpm add @rotastellar/sdk
# Bun
bun add @rotastellar/sdk
Requirements
- Node.js 18+ or Bun
- TypeScript 4.7+ (optional, but recommended)
Quick Start
import { RotaStellarClient } from '@rotastellar/sdk';
// Initialize client
const client = new RotaStellarClient({ apiKey: 'rs_your_api_key' });
// Or use environment variable
// export ROTASTELLAR_API_KEY=rs_your_api_key
const client = new RotaStellarClient();
// Track a satellite
const iss = await client.getSatellite('25544');
console.log(`ISS: ${iss.position?.latitude}, ${iss.position?.longitude}`);
Client Configuration
import { RotaStellarClient } from '@rotastellar/sdk';
const client = new RotaStellarClient({
apiKey: 'rs_...',
baseUrl: 'https://api.rotastellar.com/v1', // Default
timeout: 30000, // Request timeout in ms
maxRetries: 3, // Retry failed requests
debug: false // Enable debug logging
});
Intelligence API
Get Satellite
// Get satellite by NORAD ID
const sat = await client.getSatellite('25544'); // ISS
console.log(`Name: ${sat.name}`);
console.log(`Position: ${sat.position?.latitude}, ${sat.position?.longitude}`);
console.log(`Altitude: ${sat.position?.altitudeKm} km`);
// Get position only
const pos = await client.getSatellitePosition('25544');
console.log(`Position: ${pos.latitude}, ${pos.longitude} at ${pos.altitudeKm} km`);
List Satellites
// List satellites with filters
const satellites = await client.listSatellites({
constellation: 'Starlink',
limit: 100
});
for (const sat of satellites) {
console.log(`${sat.name}: ${sat.noradId}`);
}
// Filter by operator
const spacexSats = await client.listSatellites({
operator: 'SpaceX',
limit: 50
});
Conjunction Analysis
import { TimeRange } from '@rotastellar/sdk';
// Get conjunction risks for a satellite
const conjunctions = await client.listConjunctions({
satelliteId: '25544',
thresholdKm: 5.0,
limit: 10
});
for (const conj of conjunctions) {
console.log(`TCA: ${conj.tca}`);
console.log(`Miss distance: ${conj.miss_distance_km.toFixed(3)} km`);
console.log(`Probability: ${conj.collision_probability.toExponential(2)}`);
}
Pattern Detection
// Detect maneuvers and anomalies
const patterns = await client.listPatterns({
satelliteId: '44832', // COSMOS-2542
lookbackDays: 30
});
for (const pattern of patterns) {
console.log(`${pattern.type}: ${pattern.description}`);
console.log(`Confidence: ${(pattern.confidence * 100).toFixed(1)}%`);
}
Trajectory Prediction
// Get predicted trajectory
const trajectory = await client.getTrajectory({
satelliteId: '25544',
start: new Date(),
end: new Date(Date.now() + 2 * 60 * 60 * 1000), // +2 hours
intervalSec: 60
});
for (const point of trajectory) {
console.log(`${point.timestamp}: ${point.latitude.toFixed(2)}, ${point.longitude.toFixed(2)}`);
}
Planning API
Feasibility Analysis
// Analyze if orbital compute is viable for your workload
const result = await client.analyzeFeasibility({
workloadType: 'inference',
computeTflops: 10,
dataGb: 1.5,
latencyRequirementMs: 100,
orbitAltitudeKm: 550
});
console.log(`Feasible: ${result.feasible}`);
console.log(`Recommendation: ${result.recommendation}`);
Thermal Simulation
// Model heat rejection in orbit
const thermal = await client.simulateThermal({
powerWatts: 500,
orbitAltitudeKm: 550,
radiatorAreaM2: 2.0,
durationHours: 24
});
console.log(`Max temp: ${thermal.max_temperature_c}°C`);
console.log(`Min temp: ${thermal.min_temperature_c}°C`);
Latency Simulation
import { Position } from '@rotastellar/sdk';
// Model end-to-end latency
const source = new Position(37.7749, -122.4194); // San Francisco
const dest = new Position(51.5074, -0.1278); // London
const latency = await client.simulateLatency({
source,
destination: dest,
orbitAltitudeKm: 550,
relayCount: 2
});
console.log(`Total latency: ${latency.total_latency_ms?.toFixed(1)} ms`);
Runtime API (Coming Q2 2026)
// Submit inference job to orbital compute
const job = await client.submitJob({
model: 'llama-70b',
prompt: '...',
constraints: {
latencySlams: 200,
energyBudgetWh: 0.5
}
});
// Get result
const result = await client.getJobResult(job.id, { timeout: 30000 });
console.log(result.text);
Pagination
Handle large result sets with thePaginatedResponse class:
import { PaginatedResponse } from '@rotastellar/sdk';
// Manual pagination
let page = await client.listSatellites({
constellation: 'Starlink',
limit: 100
});
console.log(`Page has ${page.items.length} items, hasMore=${page.hasMore}`);
for (const sat of page.items) {
console.log(sat.name);
}
if (page.hasMore) {
page = await page.nextPage();
}
// Automatic pagination with async iteration
for await (const sat of client.listSatellites({ constellation: 'Starlink' })) {
console.log(sat.name);
}
PaginatedResponse Properties
| Property | Type | Description |
|---|---|---|
items | T[] | Current page of items |
hasMore | boolean | Whether more pages exist |
total | number | undefined | Total count (if available) |
limit | number | Page size |
offset | number | Current offset |
TypeScript Support
Full TypeScript definitions are included:import { RotaStellarClient } from '@rotastellar/sdk';
import type {
Satellite,
Position,
Orbit,
Conjunction,
Pattern
} from '@rotastellar/sdk';
const client = new RotaStellarClient({ apiKey: 'rs_...' });
const sat: Satellite = await client.getSatellite('25544');
const pos: Position = sat.position!;
const orbit: Orbit = sat.orbit!;
// Full autocomplete and type checking
console.log(pos.latitude); // number
console.log(pos.longitude); // number
console.log(pos.altitudeKm); // number
console.log(orbit.periodMin); // number
Error Handling
import { RotaStellarClient } from '@rotastellar/sdk';
import {
AuthenticationError,
RateLimitError,
NotFoundError,
ValidationError,
APIError
} from '@rotastellar/sdk';
const client = new RotaStellarClient({ apiKey: 'rs_...' });
try {
const sat = await client.getSatellite('INVALID-ID');
} catch (error) {
if (error instanceof NotFoundError) {
console.log('Satellite not found');
} else if (error instanceof RateLimitError) {
console.log(`Rate limited. Retry after ${error.retryAfter}s`);
} else if (error instanceof AuthenticationError) {
console.log('Invalid API key');
} else if (error instanceof ValidationError) {
console.log(`Invalid request: ${error.message}`);
} else if (error instanceof APIError) {
console.log(`API error: ${error.message}`);
}
}
Request Cancellation
Cancel long-running requests:const controller = new AbortController();
// Cancel after 5 seconds
setTimeout(() => controller.abort(), 5000);
try {
const result = await client.analyzeFeasibility({
workloadType: 'inference',
computeTflops: 100
}, { signal: controller.signal });
} catch (error) {
if (error.name === 'AbortError') {
console.log('Request cancelled');
}
}
Distributed Compute API (Coming Q1 2026)
The@rotastellar/distributed package enables Earth-space AI coordination:
npm install @rotastellar/distributed
Federated Learning
import { FederatedClient, CompressionConfig, CompressionMethod } from '@rotastellar/distributed';
// Configure gradient compression (100x reduction)
const compression: CompressionConfig = {
method: CompressionMethod.TOP_K_QUANTIZED,
kRatio: 0.01,
quantizationBits: 8,
errorFeedback: true
};
// Initialize client on orbital node
const client = new FederatedClient({
nodeId: 'orbital-3',
nodeType: 'orbital',
compression
});
// Compute and compress gradients for transmission
const gradients = client.computeGradients(modelParams, localData);
const compressed = client.compress(gradients);
See the Distributed Compute documentation for full API reference.
Logging
Enable debug logging:import { RotaStellarClient } from '@rotastellar/sdk';
const client = new RotaStellarClient({
apiKey: 'rs_...',
debug: true // Logs all requests/responses
});
// Or use custom logger
const client = new RotaStellarClient({
apiKey: 'rs_...',
logger: {
debug: console.debug,
info: console.info,
warn: console.warn,
error: console.error
}
});
Source Code
GitHub Repository
View source, report issues, and contribute.
npm Package
Package page and version history.

