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.
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
JavaScript Documentation
Quick Start
Install, configure API key, and make your first query in under 5 minutes.
JavaScript API
TaxiaClient methods, options, streaming, retries, caching, and error handling.
React Guide
Hooks, streaming UI, and cache-aware queries for React apps.
Vue Guide
Composables and component patterns for TAXIA queries in Vue.
Next.js Guide
Server Actions, Edge runtime, and streaming responses with TAXIA.
HF Loader
Offline data loading with ETag caching for 2015-2025 tax laws.
JS FAQ
Common questions, error fixes, and integration tips.
npm Package
Install @xaikorea0/js-client, view versions, and release notes.
GitHub Source
Type-safe client, adapters, and examples in the JS source tree.
Python Docs
Return to the Python/Engine documentation and root TAXIA site.
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
Install via npm and integrate in under 10 lines of code. Works in Node.js, browsers, and Edge runtimes.
Built-in retry logic, error handling, caching, and timeout management for enterprise reliability.
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.