Skip to main content
Hero Light

What is kSync?

kSync v0.2 is an enterprise-grade, real-time sync engine that delivers 600k+ operations per second with developer-friendly APIs. Designed for modern web and AI applications that need instant real-time collaboration, streaming support, and production-ready scalability — without the complexity.

Key Features

Get started instantly with createKSync(), createChat(), createTodos(), createGame(), createAI() - each optimized for specific use cases with intelligent defaults.
600k+ operations per second with only 2MB memory usage for 1000 clients. Network resilient with graceful 10-200ms latency handling.
Built-in support for AI streaming responses, live data streams, and real-time chunk processing with automatic flow control.
Real-time user presence with status tracking, metadata support, room-based isolation, and automatic cleanup.
Automatic room management and routing with isolated event streams and presence tracking per room.
Advanced offline support with event queueing, persistence, and automatic sync when reconnected.
50+ configuration options with full TypeScript documentation covering performance, authentication, debugging, and features.
Authentication providers, token management, client-side encryption options, and secure WebSocket connections.
Performance metrics, debugging tools, status monitoring, and comprehensive logging for production deployments.
All v0.1 APIs continue to work without changes while gaining access to new v0.2 features.

Why Choose kSync v0.2?

Ready in seconds, not hoursFactory functions with smart defaults mean you can start building real-time features immediately without complex configuration.

Quick Examples

Instant Chat Application

import { createChat } from '@klastra/ksync';

// Chat app with presence and optimized batching
const chat = createChat('my-room', {
  serverUrl: 'ws://localhost:8080'
});

// Set user presence
await chat.setPresence({
  status: 'online',
  metadata: { name: 'Alice', avatar: 'avatar-url' }
});

// Send messages
await chat.send('message', {
  text: 'Hello everyone!',
  author: 'Alice',
  timestamp: Date.now()
});

// Listen for messages
chat.on('message', (data) => {
  console.log(`${data.author}: ${data.text}`);
});

AI Streaming Application

import { createAI } from '@klastra/ksync';

// AI with streaming responses
const ai = createAI('assistant', {
  features: { streaming: true }
});

// Listen for streaming chunks
ai.on('stream-chunk', (data) => {
  process.stdout.write(data.data); // Live AI response
});

// Start AI response stream
await ai.startStream('response-1');
await ai.streamChunk('response-1', { data: 'Hello! ' });
await ai.streamChunk('response-1', { data: 'How can I help?' });
await ai.endStream('response-1');

Basic Real-time Sync

import { createKSync } from '@klastra/ksync';

// Works instantly with smart defaults
const ksync = createKSync();

// Listen for events
ksync.on('message', (data, event) => {
  console.log(`${event.userId}: ${data.text}`);
});

// Send events (instant local, auto-synced if server configured)
await ksync.send('message', {
  text: 'Hello world!',
  timestamp: Date.now()
});

Use Cases

kSync v0.2 is perfect for:
  • 💬 Real-time chat applications with presence, typing indicators, and multi-room support
  • 🎮 Multiplayer games with low-latency updates, player presence, and state synchronization
  • 🤖 AI-powered applications with streaming responses, real-time feedback, and conversation management
  • 📝 Collaborative editing with conflict-free operations and real-time cursors
  • 📊 Live dashboards with real-time data updates and user presence
  • 📋 Project management with task updates, team collaboration, and offline sync
  • 🏪 E-commerce platforms with real-time inventory, cart sync, and customer presence
  • 📱 Mobile applications with offline-first design and automatic sync
  • 🏢 Enterprise tools requiring high performance, security, and reliability

Performance at Scale

Enterprise Benchmarks: kSync v0.2 delivers exceptional performance:
  • 🎯 600k+ ops/sec for 500 concurrent clients
  • 🧠 2MB memory for 1000 clients + 10k events
  • 🌐 Network resilient - handles 10-200ms latency gracefully
  • 💬 300k+ ops/sec for high-load chat across multiple rooms

Getting Started


kSync v0.2: From prototype to production, without the complexity.