Three-Pillar Architecture
SERVICE, DATA, and PIPELINE pillars with 23 focused methods. Clean separation of concerns with predictable patterns.
23 methods. Configuration objects. Zero dependencies.
import { service, data, pipeline, Result } from '@sanzoku-labs/kairo'
// SERVICE: HTTP operations with configuration
const users = await service.get('/api/users', {
timeout: 5000,
retry: { attempts: 3 },
cache: { enabled: true, ttl: 300 }
})
// DATA: Schema creation and validation
const UserSchema = data.schema({
id: { type: 'string', format: 'uuid' },
name: { type: 'string', min: 2, max: 100 },
email: { type: 'string', format: 'email' },
active: { type: 'boolean' }
})
// PIPELINE: Logic composition
const processUsers = pipeline.compose([
users => pipeline.filter(users, user => user.active),
users => pipeline.map(users, user => data.validate(user, UserSchema)),
users => data.aggregate(users, {
groupBy: ['department'],
sum: ['salary'],
avg: ['experience']
})
])
// Result pattern for error handling
const result = await processUsers(users)
Result.match(result, {
Ok: analytics => console.log('Success:', analytics),
Err: error => console.error('Error:', error.message)
})HTTP-only API operations with rich configuration support.
// GET with validation and caching
const users = await service.get('/api/users', {
headers: { Authorization: 'Bearer token' },
timeout: 5000,
retry: { attempts: 3, delay: 1000 },
cache: { enabled: true, ttl: 300 },
validate: UserArraySchema
})Methods: get(), post(), put(), patch(), delete() + 4 utilities
Data validation, transformation, and aggregation with native performance.
// Schema creation and validation
const ProductSchema = data.schema({
id: { type: 'string', format: 'uuid' },
name: { type: 'string', min: 1, max: 200 },
price: { type: 'number', min: 0 },
category: { type: 'string', enum: ['electronics', 'books'] }
})
// Data aggregation
const analytics = data.aggregate(salesData, {
groupBy: ['region', 'quarter'],
sum: ['revenue', 'units'],
avg: ['satisfaction'],
count: ['orders']
})Methods: schema(), validate(), transform(), convert(), aggregate(), groupBy(), serialize(), deserialize(), clone(), merge() + 6 utilities
Logic composition and workflows with functional programming patterns.
// Complex data processing pipeline
const dataProcessor = pipeline.compose([
// Step 1: Validate input
data => pipeline.validate(data, InputSchema),
// Step 2: Transform and filter
data => pipeline.map(data, item => ({ ...item, processed: true })),
data => pipeline.filter(data, item => item.isValid),
// Step 3: Aggregate results
data => data.aggregate(data, {
groupBy: ['type'],
sum: ['amount'],
count: ['items']
})
])Methods: map(), filter(), reduce(), compose(), chain(), branch(), parallel(), validate() + 5 utilities
Ready to build with Kairo? Start with our Getting Started Guide or explore Examples to see real-world usage patterns.
Ready for Production: Kairo is production-ready with 100% TypeScript compliance, zero ESLint warnings, and comprehensive test coverage.