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, Voice & Phone Agents with any AI models, 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, agent, deepgram, cartesia, openaiRealtime, twilio, aiAdminPage } from 'jsango';
// One agent, any LLM provider: the same instructions, tools and memory everywhere
const support = agent({
provider: myLlm,
instructions: 'You are a friendly support agent. Keep answers short.',
tools: { lookupOrder: orderTool },
memory: true,
});
const app = createApp();
// 1. Talk in the browser: any speech-to-text, your LLM, any text-to-speech (all streaming)
app.voiceAgent('/voice', support, { stt: deepgram(), tts: cartesia({ voiceId: 'warm-voice' }) });
// 2. Speech-to-speech over WebRTC; the API key never leaves the server
app.webrtcAgent('/voice/rtc', support, { realtime: openaiRealtime() });
// 3. Phone calling agents: answer calls and dial out
const line = app.phoneAgent('/phone', support, {
carrier: twilio(),
stt: deepgram(),
tts: cartesia({ voiceId: 'warm-voice' }),
});
await line.dial('+919876543210');
// 4. Usage, cost, latency, transcripts and recordings in the admin
const insights = app.aiInsights({ store: db });
app.admin({ pages: [aiAdminPage(insights)] });
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 retries
jobs.register('send-welcome-email', async ({ email, name }: { email: string; name: string }) => {
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: { id: string }) => {
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 passwords (TOTP) for 2FA
const totp = new TotpService();
// Setup: store `secret`, show `uri` as a QR code in the authenticator app
const { secret, uri } = totp.generateSecret({
accountName: 'admin@jsango.dev',
issuer: 'JSango Security',
});
// Login: check the 6-digit code (ยฑ1 time step)
const isValid = totp.verifyToken('482910', secret, { 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.
Let users talk to your agents in the browser or on a phone call. Bring any LLM, any speech-to-text and any text-to-speech, including your own self-hosted models, or use a speech-to-speech provider.
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 }
});
Express and Fastify give you a router; NestJS gives you structure. You still pick, install and wire an ORM, auth, validation, an admin, jobs and docs yourself. JSango ships all of it, designed to work together.
| Express | Fastify | NestJS | JSango | |
|---|---|---|---|---|
| Routing & middleware | โ | โ | โ | โ |
| Request validation | โ | โ | โ | โ |
| ORM + migrations (Postgres, MySQL, SQLite, MongoDB) | โ | โ | โ | โ |
| Auth: JWT, sessions, API keys, OAuth, 2FA | โ | โ | โ | โ |
| Auto-generated admin panel | โ | โ | โ | โ |
| One-line secure REST CRUD | โ | โ | โ | โ |
| WebSockets with rooms & server push | โ | โ | โ | โ |
| Background jobs | โ | โ | โ | โ |
| OpenAPI + Swagger UI | โ | โ | โ | โ |
| CORS, security headers, rate limits | โ | โ | โ | โ |
| AI agents, tools & MCP | โ | โ | โ | โ |
| Voice & phone agents (any STT, LLM, TTS) | โ | โ | โ | โ |
| Requests/sec, JSON hello world (measured) | 16.0k | 60.1k | not measured | 57.8k |
โ built in ยท โ official plugin / module to install and wire up ยท โ bring your own library
Paginated list with search, detail, admin-only create / update / delete with validation, CORS, security headers and rate limiting.
import express from 'express';
import cors from 'cors';
import helmet from 'helmet';
import rateLimit from 'express-rate-limit';
import jwt from 'jsonwebtoken';
import { z } from 'zod';
import { PrismaClient } from '@prisma/client'; // + schema.prisma + prisma generate
const prisma = new PrismaClient();
const app = express();
app.use(express.json(), helmet(), rateLimit({ windowMs: 60_000, limit: 300 }));
app.use(cors({ origin: ['https://app.example.com'], credentials: true }));
const requireAdmin: express.RequestHandler = (req, res, next) => {
const token = req.headers.authorization?.replace('Bearer ', '') ?? '';
try {
const user = jwt.verify(token, process.env.JWT_SECRET!) as { role?: string };
if (user.role !== 'admin') return res.status(403).json({ error: 'Forbidden' });
next();
} catch {
res.status(401).json({ error: 'Unauthorized' });
}
};
const ProductInput = z.object({ name: z.string().min(2), price: z.number().min(0) });
app.get('/products', async (req, res) => {
const page = Math.max(1, Number(req.query.page) || 1);
const pageSize = Math.min(100, Math.max(1, Number(req.query.pageSize) || 20));
const search = String(req.query.search ?? '');
const where = search ? { name: { contains: search, mode: 'insensitive' as const } } : {};
const [items, total] = await Promise.all([
prisma.product.findMany({ where, skip: (page - 1) * pageSize, take: pageSize }),
prisma.product.count({ where }),
]);
res.json({ items, total, page, pageSize, totalPages: Math.ceil(total / pageSize) });
});
app.get('/products/:id', async (req, res) => {
const item = await prisma.product.findUnique({ where: { id: Number(req.params.id) } });
if (!item) return res.status(404).json({ error: 'Not found' });
res.json(item);
});
app.post('/products', requireAdmin, async (req, res) => {
const parsed = ProductInput.safeParse(req.body);
if (!parsed.success) return res.status(400).json({ error: parsed.error.flatten() });
res.status(201).json(await prisma.product.create({ data: parsed.data }));
});
app.patch('/products/:id', requireAdmin, async (req, res) => {
const parsed = ProductInput.partial().safeParse(req.body);
if (!parsed.success) return res.status(400).json({ error: parsed.error.flatten() });
try {
const id = Number(req.params.id);
res.json(await prisma.product.update({ where: { id }, data: parsed.data }));
} catch {
res.status(404).json({ error: 'Not found' });
}
});
app.delete('/products/:id', requireAdmin, async (req, res) => {
try {
await prisma.product.delete({ where: { id: Number(req.params.id) } });
res.status(204).end();
} catch {
res.status(404).json({ error: 'Not found' });
}
});
app.listen(3000);
// Admin panel, migrations, WebSockets, jobs, OpenAPI: more libraries and code.
import {
createApp, createAuth, defineModel, fields,
cors, securityHeaders, rateLimit, schema, string, number,
} from 'jsango';
const Product = defineModel('Product', {
id: fields.id(),
name: fields.string(),
price: fields.decimal(),
});
const auth = createAuth({ secret: process.env.AUTH_SECRET!, users: userStore });
const app = createApp();
app.use(securityHeaders(), rateLimit({ max: 300 }));
app.use(cors({ origin: ['https://app.example.com'], credentials: true }));
// List (paginated + search), detail, create, update, delete: validated and secured
app.crud('/products', Product, {
access: { write: auth.required({ roles: ['admin'] }) },
searchFields: ['name'],
schema: schema({ name: string().min(2), price: number().min(0) }),
});
app.admin({ auth, resources: [Product] }); // bonus: full admin panel at /admin
await app.listen(3000);
// Migrations: npx jsango makemigrations && npx jsango migrate
The same three endpoints in plain node:http, Express, Fastify and JSango, each in its own process, loaded by autocannon. JSango does it while shipping an ORM, auth, admin and jobs in the same package.
Apple M2 (8 cores), Node.js v22.14.0, 2026-10-09. Express 5.2.1, Fastify 5.12.5, JSango 1.6.0; NODE_ENV=production, no logging, 100 connections, 3 s warm-up then 10 s per scenario. Validation: a hand-written check in Express and plain Node, JSON Schema in Fastify, validate(schema(...)) in JSango.
Run it yourself: pnpm build && pnpm bench:compare (benchmarks/compare).
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.