JavaScript SDK Installation

@vedika-io/sdk

Current SDK Last updated: January 2026

Quick Install

Install the Vedika SDK using your preferred package manager:

npm
npm install @vedika-io/sdk
yarn
yarn add @vedika-io/sdk
pnpm
pnpm add @vedika-io/sdk

Requirements

Node.js >= 18.0.0
TypeScript >= 4.7 (optional, types included)
Browser Support ES2020+ (Chrome 80+, Firefox 74+, Safari 14+)

Verify Installation

After installation, verify the SDK is working:

const { VedikaClient, VERSION } = require('@vedika-io/sdk');

// Check version
console.log(VERSION);

// Initialize client
const vedika = new VedikaClient({
  apiKey: process.env.VEDIKA_API_KEY
});

// Construction does not verify key validity with the server.
console.log(typeof VedikaClient);

TypeScript Setup

The SDK includes TypeScript definitions out of the box. No additional setup required.

import { VedikaClient } from '@vedika-io/sdk';
import type { BirthChartQuery } from '@vedika-io/sdk';

async function main() {
  const apiKey = process.env.VEDIKA_API_KEY;
  if (!apiKey) throw new Error('Set VEDIKA_API_KEY on the server');

  const vedika = new VedikaClient({
    apiKey,
    timeout: 30000,
    maxRetries: 3
  });

  const input: BirthChartQuery = {
    datetime: '1990-05-15T10:30:00+05:30',
    latitude: 28.6139,
    longitude: 77.2090,
    timezone: '+05:30'
  };
  const chart = await vedika.getBirthChart(input);
  return chart;
}

main().catch(() => {
  console.error('Calculation failed');
  process.exitCode = 1;
});
Recommended tsconfig.json settings: "moduleResolution": "bundler" or "node16"

Browser Requests Through Your Server

Keep the SDK and API key on your authenticated application server. Browsers call its same-origin route:

const response = await fetch('/api/birth-chart', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    datetime: '1990-05-15T10:30:00+05:30',
    latitude: 28.6139,
    longitude: 77.2090,
    timezone: '+05:30'
  })
});
if (!response.ok) throw new Error('Your backend returned an error');
const chart = await response.json();
Security Warning: Never expose your API key in client-side code for production apps. Use a backend proxy instead.

Environment Variables

Your server explicitly passes its environment configuration to the SDK:

# Server environment; the API key value stays private
# Configure VEDIKA_API_KEY in your protected server environment first.
# Export the existing variable without assigning or revealing its value.
export VEDIKA_API_KEY
VEDIKA_BASE_URL=https://api.vedika.io
VEDIKA_TIMEOUT=60000
VEDIKA_MAX_RETRIES=3
import { VedikaClient } from '@vedika-io/sdk';

const apiKey = process.env.VEDIKA_API_KEY;
if (!apiKey) throw new Error('Set VEDIKA_API_KEY on the server');

const vedika = new VedikaClient({
  apiKey,
  baseUrl: process.env.VEDIKA_BASE_URL,
  timeout: Number(process.env.VEDIKA_TIMEOUT ?? 60000),
  maxRetries: Number(process.env.VEDIKA_MAX_RETRIES ?? 3)
});

Package Contents

Main Exports

  • VedikaClient - Main client class
  • VedikaAPIError - Error types
  • VERSION - Package version

Type Exports

  • BirthChart - Chart response type
  • CompatibilityQuery - Match request type
  • BirthChartQuery - Chart request type
  • DashaResponse - Dasha type

Next Steps