Stop stitching together dozens of disjointed libraries. JSango delivers a cohesive, enterprise-grade ecosystem: Declarative ORM, SegRadix Router (>7.7M ops/sec), Auto-Generated React Admin Panel, AI Agents & Workflows, 2FA Auth, Background Queues, and WebSockets.
import { model, fields } from 'jsango';
// 1. Strongly-typed declarative model
export const User = model('User', {
id: fields.id(),
email: fields.string({ unique: true }),
name: fields.string(),
role: fields.string({ defaultValue: 'viewer' }),
active: fields.boolean({ defaultValue: true }),
});
// 2. Query seamlessly with static model helpers
const users = await User.where('active', true)
.orderBy('createdAt', 'desc')
.limit(20)
.get();
const newUser = await User.create({ name: 'Alex', email: 'alex@jsango.dev' });
import { agent, tool, object, string, number, createApp } from 'jsango';
// 1. Define type-safe tools with automatic JSON Schema generation
const lookupOrder = tool({
name: 'lookupOrder',
description: 'Get order status by order ID',
schema: object({ orderId: string() }),
execute: async ({ orderId }) => await Order.find(orderId),
});
const refundOrder = tool({
name: 'refundOrder',
description: 'Issue customer refund',
schema: object({ orderId: string(), amount: number() }),
requiresApproval: true, // Human approval gate
execute: async ({ orderId, amount }) => await PaymentService.refund(orderId, amount),
});
// 2. Create the Autonomous Agent
export const supportAgent = agent({
name: 'SupportAgent',
model: 'openai:gpt-4o',
instructions: 'Help customers check orders and handle refund requests.',
tools: { lookupOrder, refundOrder },
});
// 3. Expose over HTTP / SSE Streaming and WebSockets in 1 line
const app = createApp();
app.agent('/api/support', supportAgent);
app.wsAgent('/ws/support', supportAgent);
await app.listen(3000);
import { createApp, validate, schema, string, email, notFound } from 'jsango';
import { User } from './models/user.js';
const app = createApp();
// Ultra-fast routing with automatic JSON responses & typed context
app.get('/users/:id', async ({ params }) => {
const user = await User.find(params.id);
if (!user) throw notFound('User not found');
return user;
});
// Fluent request validation
app.post('/users', validate({
body: schema({ name: string().min(2), email: email() })
}), async ({ body }) => {
return User.create(body);
});
await app.listen(3000);
import { createApp } from 'jsango';
import { User } from './models/user.js';
const app = createApp();
// 1. Generate full REST CRUD endpoints in one single call
app.crud('/api/users', User);
// 2. Mount instant React Admin Panel with automatic schema discovery
app.admin({
path: '/admin',
resources: [User],
});
// 3. Expose interactive OpenAPI documentation
app.openapi({ path: '/openapi.json', docsPath: '/docs' });
await app.listen(3000);
import { createApp } from 'jsango';
const app = createApp();
// Concise WebSocket endpoint with automatic JSON serialization & rooms
app.ws('/chat', (socket) => {
socket.on('join', (room) => {
socket.join(room);
socket.to(room).send({ type: 'joined', user: socket.id });
});
socket.on('message', ({ room, text }) => {
socket.to(room).send({ type: 'message', from: socket.id, text });
});
});
await app.listen(3000);
import { jobs, events, cache } from 'jsango';
// 1. Background Jobs with exponential retries
jobs.define('send-welcome-email', async ({ email, name }) => {
await mailService.send(email, \`Welcome \${name}!\`);
});
await jobs.dispatch('send-welcome-email', { email: 'alex@jsango.dev', name: 'Alex' });
// 2. Application Events
events.on('user.created', async (user) => {
await analytics.track('Signup', { id: user.id });
});
// 3. Stampede-protected Caching
const metrics = await cache.remember('app:metrics', 60, async () => {
return computeHeavyMetrics();
});
import { TotpService } from '@jsango/auth';
// RFC 6238 Time-based One-Time Password (TOTP) 2FA
const totp = new TotpService();
// Setup Two-Factor Authenticator
const secret = totp.generateSecret();
const qrUri = totp.generateKeyUri({
secret,
accountName: 'admin@jsango.dev',
issuer: 'JSango Security'
});
// Validate 6-digit TOTP code during login
const isValid = totp.verifyToken({ secret, token: '482910', window: 1 });
if (!isValid) {
throw new AuthenticationError('Invalid 2FA Verification Code');
}
JSango eliminates decision fatigue. Enjoy curated, strictly typed tools engineered to work together seamlessly without configuration hell.
Provider-neutral LLM agent runtime (OpenAI, Claude, Gemini, Ollama) with tool calling, human-in-the-loop approvals, RAG vector search, and MCP JSON-RPC support.
Complete React SPA admin interface with CRUD, instant search, faceted filters, batch bulk actions, dynamic relations, and export/import.
Type-safe schema definitions, AST query builders, batch eager loading to eliminate N+1 queries, and automated schema diff migrations.
Custom Segment Radix Trie router designed for extreme concurrency, zero allocations on hot paths, and constraint-based param matching.
Battle-tested authentication with Session cookies, JWTs, API Keys, Scrypt password hashing, TOTP 2FA, and CSRF/CORS protection.
Background job worker queues with retries and dead-letter stores, typed event emitter with tri-mode execution, and multi-room WebSockets.
First-class Prometheus metrics, structured JSON telemetry, monotonic request tracing, health probes, and automated OpenAPI 3.1 docs.
Click any layer below to explore how JSango enforces strict dependency boundaries and runtime independence.
Abstracts platform differences between Node.js 20+ and modern JavaScript runtimes without coupling business logic to node APIs.
import { createRuntimeAdapter } from '@jsango/runtime';
// High-performance Node.js runtime adapter
export const runtime = createRuntimeAdapter({
platform: 'node',
features: { http2: true, cluster: true }
});
Zero reflection on hot paths, segment radix tree matching, and zero-allocation body streaming deliver outstanding real-world performance.
Use the full stack together or pick individual packages. Each package adheres to strict zero-circular-dependency rules.
Provider-neutral AI agent runtime, tool validation, multi-agent workflows, RAG, and MCP.
Application lifecycle coordinator, structured error hierarchy, and logging abstractions.
High-performance DI container supporting transient, singleton, and scoped lifetimes.
Segment Radix Trie router (>7.7M ops/sec) with typed constraint matching.
Runtime-independent HTTP request/response abstractions and streaming body parsers.
Declarative models, AST query builder, and pure batch eager loading (.with()).
Schema diffing engine, DDL compilers, distributed locks, and migration runners.
Multi-connection manager, FIFO connection pool, and scoped transaction state machines.
Interactive React SPA admin dashboard with CRUD views, filters, and theme switcher.
Admin REST orchestrator for CRUD endpoints, 2FA auth, session revoke, and export.
Staff authorization, resource-level CRUD permissions, and field-level visibility rules.
RFC 6238 TOTP 2FA engine, Session/JWT auth, Scrypt hashing, and policy RBAC.
At-least-once background job queues, concurrent worker polling, and dead-letter store.
Multi-room WebSocket management with heartbeat monitoring and backpressure safeguards.
Deterministic OpenAPI 3.1 document generation from router, validation, ORM, and Admin.
Structured JSON logging, Prometheus metrics, monotonic tracing, and health checks.
CLI developer tooling, scaffolding commands, migration generators, and dev servers.