Graph-RAG JS Client for TAXIA

Type-safe JavaScript/TypeScript client with real-time streaming (SSE), automatic retries with exponential backoff, TTL-based caching, and production-ready framework adapters for React, Vue, and Next.js applications.

100%
TypeScript
<5KB
Bundle Size
3
Frameworks
TAXIA Logo

JavaScript SDK Features

Modern client library for TAXIA integration

⚑

Real-time Streaming

Server-Sent Events (SSE) using EventSource API for progressive token-by-token response rendering with automatic reconnection, heartbeat monitoring, and error recovery.

πŸ”„

Smart Retries

Exponential backoff (baseDelay * 2^attempt) with jitter randomization, configurable max retries (default: 3), and per-request timeout control (default: 10s) for 99.9% reliability.

πŸ’Ύ

Automatic Caching

TTL-based LRU cache (default: 5min expiry, 100 entries max) with SHA-256 query hashing, manual invalidation API, and localStorage persistence for offline support.

βš›οΈ

Framework Adapters

First-class support for React hooks, Vue composables, and Next.js integration.

πŸ”’

Type Safety

Full TypeScript support with strict typing for all API methods and responses.

🌐

Universal Runtime

Works in Node.js, browser, Edge functions, and serverless environments.

JavaScript Technology Stack

Modern web technologies and best practices

Language
TypeScript 5.3+ (Strict Mode)
Build System
Webpack 5 + Babel 7 + ESM
React Support
Hooks API + Context (React 18+)
Vue Support
Composition API (Vue 3.3+)
Testing
Jest 29 + React Testing Library
Package
npm + ESM/CJS dual export

Complete Usage Example (TypeScript)

import { TaxiaClient, QueryResponse, TaxiaError } from '@xaikorea0/js-client';

// Initialize with full configuration
const client = new TaxiaClient({
  apiKey: process.env.TAXIA_API_KEY!,
  baseUrl: 'https://api.taxia.ai/v1',  // Optional: custom endpoint
  timeoutMs: 10000,  // 10s timeout
  retry: {
    retries: 3,  // Max retry attempts
    baseDelayMs: 300,  // Initial backoff
    maxDelayMs: 5000,  // Max backoff cap
  },
  cacheEnabled: true,
  cacheTtlMs: 300000,  // 5 minutes
});

// Type-safe query
try {
  const response: QueryResponse = await client.query(
    '법인세 κ³Όμ„Έν‘œμ€€ ꡬ간별 μ„Έμœ¨μ„ μ•Œλ €μ£Όμ„Έμš”',
    { stream: false }
  );
  
  console.log(response.answer);  // string
  console.log(response.citations);  // Citation[]
  console.log(response.metadata.latency_ms);  // number
} catch (error) {
  if (error instanceof TaxiaError) {
    console.error(`Error [${error.code}]: ${error.message}`);
  }
}

// Streaming with progress callback
let fullText = '';
await client.queryStream(
  'λΆ€κ°€κ°€μΉ˜μ„Έ λ‚©λΆ€ 절차 μ„€λͺ…ν•΄μ€˜',
  (chunk: string) => {
    fullText += chunk;
    console.log('Progress:', fullText.length);
  }
);

// Manual cache control
client.cache.clear();  // Clear all cached queries
client.cache.delete('specific-query');  // Remove one entry

πŸ“Š Client Performance

  • Bundle Size: 4.8KB minified+gzipped (tree-shakeable)
  • Cache Hit Rate: 80%+ for repeated queries (5min TTL)
  • Retry Success: 99.9% delivery with exponential backoff
  • SSE Latency: First token <500ms, streaming 50-100 tokens/s
  • Browser Support: Chrome 90+, Firefox 88+, Safari 14+, Edge 90+
  • Node.js: v16.x, v18.x, v20.x LTS versions

Technical Requirements

πŸ“¦ Package Manager

  • βœ“ npm 8.0+ (Node 16+)
  • βœ“ yarn 1.22+ or 3.x (Berry)
  • βœ“ pnpm 8.0+ (recommended)
  • βœ“ ESM and CommonJS support

🌐 Runtime Support

  • βœ“ Node.js 16.x, 18.x, 20.x LTS
  • βœ“ Browser: Chrome 90+, Firefox 88+
  • βœ“ Deno 1.30+ (experimental)
  • βœ“ Edge Workers (Cloudflare, Vercel)

βš›οΈ Framework Versions

  • β†’ React 18.0+ (Hooks API)
  • β†’ Vue 3.3+ (Composition API)
  • β†’ Next.js 13.4+ (App Router)
  • β†’ TypeScript 5.0+ (optional)

πŸ”§ TypeScript Configuration

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

⚠️ Known Limitations

  • SSE Support: Not available in React Native (use polling fallback)
  • CORS: Backend must enable CORS for browser usage
  • API Key: Never expose in client-side code (use proxy/backend)
  • Bundle Size: 4.8KB base + 2KB per framework adapter
  • Cache Storage: localStorage limited to ~5MB in browsers

Why Developers Choose TAXIA JS

⚑
Fast Integration

Install via npm and integrate in under 10 lines of code. Works in Node.js, browsers, and Edge runtimes.

πŸ›‘οΈ
Production Ready

Built-in retry logic, error handling, caching, and timeout management for enterprise reliability.

🎯
Framework Native

First-class React hooks, Vue composables, and Next.js patterns. Not just a wrapper.

Quick Start Command

npm install @xaikorea0/js-client

Then import and start querying in seconds. TypeScript types included.

Ready to Build with TAXIA?

Install the JavaScript SDK, configure your API key, and ship Korean tax AI features in your app today. TypeScript support included.

Quick Start Guide β†’ React Integration Vue Integration