JavaScript SDK Installation

@vedika/sdk

v2.4.0 Last updated: January 2026

Quick Install

Install the Vedika SDK using your preferred package manager:

npm
npm install @vedika/sdk
yarn
yarn add @vedika/sdk
pnpm
pnpm add @vedika/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:

import { VedikaClient } from '@vedika/sdk';

// Check version
console.log(VedikaClient.VERSION); // '2.4.0'

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

// Test connection
const health = await vedika.health();
console.log('API Status:', health.status); // 'ok'

TypeScript Setup

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

import {
  VedikaClient,
  BirthChart,
  KundliMatch,
  Panchang,
  VedikaError
} from '@vedika/sdk';

// Full type safety
const vedika = new VedikaClient({
  apiKey: process.env.VEDIKA_API_KEY!,
  timeout: 30000,
  retries: 3
});

// Response types are fully typed
const chart: BirthChart = await vedika.birthChart({
  datetime: '1990-05-15T10:30:00+05:30',
  latitude: 28.6139,
  longitude: 77.2090
});
Recommended tsconfig.json settings: "moduleResolution": "bundler" or "node16"

CDN Usage (Browser)

For browser-only projects without a build step:

<!-- UMD Bundle -->
<script src="https://unpkg.com/@vedika/sdk@2.4.0/dist/vedika.umd.js"></script>
<script>
  const vedika = new Vedika.Client({
    apiKey: 'your-api-key'
  });

  vedika.panchang({ date: '2026-01-07' })
    .then(data => console.log(data));
</script>

<!-- ES Module -->
<script type="module">
  import { VedikaClient } from 'https://unpkg.com/@vedika/sdk@2.4.0/dist/vedika.esm.js';

  const vedika = new VedikaClient({ apiKey: 'your-api-key' });
</script>
Security Warning: Never expose your API key in client-side code for production apps. Use a backend proxy instead.

Environment Variables

The SDK automatically reads from environment variables:

# .env file
VEDIKA_API_KEY=vk_live_abc123xyz789
VEDIKA_BASE_URL=https://api.vedika.io  # Optional, defaults to production
VEDIKA_TIMEOUT=30000                    # Optional, milliseconds
VEDIKA_MAX_RETRIES=3                    # Optional
// The SDK auto-detects VEDIKA_API_KEY
import { VedikaClient } from '@vedika/sdk';

// No need to pass apiKey if env var is set
const vedika = new VedikaClient();

Package Contents

Main Exports

  • VedikaClient - Main client class
  • VedikaError - Error types
  • createClient - Factory function

Type Exports

  • BirthChart - Chart response type
  • KundliMatch - Match response type
  • Panchang - Panchang type
  • DashaPeriod - Dasha type

Next Steps