JSango v1.6.0 Production Release ยท Batteries-Included & AI Platform

The Complete Backend Framework for TypeScript.
Fast. Typed. Batteries Included.

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');
}

Everything You Need for Enterprise Backends

JSango eliminates decision fatigue. Enjoy curated, strictly typed tools engineered to work together seamlessly without configuration hell.

๐Ÿค–

First-Class AI Agents & Workflows

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.

  • โœ“ Autonomous reasoning loop & tool dispatch
  • โœ“ 1-line HTTP / SSE & WebSocket agent streaming
  • โœ“ Zero-cost deterministic testing fixtures
๐ŸŽ™๏ธ

Voice & Phone Calling Agents

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.

  • โœ“ Streaming pipeline: first sentence spoken while the LLM still writes
  • โœ“ Barge-in: interrupt the agent, memory keeps only what was heard
  • โœ“ WebSocket, WebRTC & Twilio phone calls (inbound + outbound)
  • โœ“ Usage, cost, latency & recordings in the admin panel
๐Ÿ–ฅ๏ธ

Auto-Generated Admin Console

Complete React SPA admin interface with CRUD, instant search, faceted filters, batch bulk actions, dynamic relations, and export/import.

  • โœ“ Zero boilerplate resource registration
  • โœ“ 2FA TOTP security & active session management
  • โœ“ Granular RBAC field & resource permissions
๐Ÿ—„๏ธ

Declarative ORM & Migrations

Type-safe schema definitions, AST query builders, batch eager loading to eliminate N+1 queries, and automated schema diff migrations.

  • โœ“ Strict compile-time query validation
  • โœ“ Automated schema diffing & DDL compilers
  • โœ“ Connection pooling & scoped transactions
โšก

SegRadix Router (>7.7M ops/sec)

Custom Segment Radix Trie router designed for extreme concurrency, zero allocations on hot paths, and constraint-based param matching.

  • โœ“ 7,700,000+ route lookups per second
  • โœ“ Typed parameter constraints (:uuid, :int, :slug)
  • โœ“ Onion middleware pipeline with async context
๐Ÿ”

Authentication & Security

Battle-tested authentication with Session cookies, JWTs, API Keys, Scrypt password hashing, TOTP 2FA, and CSRF/CORS protection.

  • โœ“ Built-in RFC 6238 TOTP 2FA engine
  • โœ“ Device session tracking & remote revocation
  • โœ“ Scrypt key derivation & brute-force throttling
๐Ÿ“ฌ

Queues, Events & Realtime

Background job worker queues with retries and dead-letter stores, typed event emitter with tri-mode execution, and multi-room WebSockets.

  • โœ“ At-least-once background queue processing
  • โœ“ Typed event bus (Sync, Async, Queued)
  • โœ“ Multi-room WebSocket with heartbeat monitor
๐Ÿ“Š

Observability & OpenAPI 3.1

First-class Prometheus metrics, structured JSON telemetry, monotonic request tracing, health probes, and automated OpenAPI 3.1 docs.

  • โœ“ Automated OpenAPI 3.1 & Swagger generation
  • โœ“ Prometheus metrics endpoint (/metrics)
  • โœ“ Liveness & readiness health check probes

Strict Layered Architecture

Click any layer below to explore how JSango enforces strict dependency boundaries and runtime independence.

01 Runtime Adapter
@jsango/runtime
02 Core Lifecycle & DI
@jsango/core
03 HTTP Abstraction
@jsango/http
04 SegRadix Router
@jsango/router
05 Middleware Pipeline
@jsango/middleware
06 Declarative ORM
@jsango/orm
07 Auto Admin Console
@jsango/admin-ui
08 AI Platform & Agents
@jsango/ai

1. Runtime Layer

@jsango/runtime

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 }
});

One framework instead of fifteen libraries

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.

ExpressFastifyNestJSJSango
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.0k60.1knot measured57.8k

โœ“ built in  ยท  โ— official plugin / module to install and wire up  ยท  โ€” bring your own library

The same secure products API

Paginated list with search, detail, admin-only create / update / delete with validation, CORS, security headers and rate limiting.

Express + 6 libraries62 lines
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.
JSango20 lines ยท + admin panel
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

Batteries included, still fast

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.

3.0โ€“3.6ร—
Faster than Express
82โ€“96%
Of Fastify's throughput
41.5k
Validated POSTs / sec
4 ms
p99 latency at 100 connections

JSON hello world

โšก JSango57,814 req/s ยท p99 3 ms
57.8k
Fastify60,074 req/s ยท p99 3 ms
60.1k
Express15,996 req/s ยท p99 8 ms
16.0k
node:http (no framework, baseline)88,399 req/s ยท p99 2 ms
88.4k

Route params

โšก JSango52,889 req/s ยท p99 3 ms
52.9k
Fastify62,013 req/s ยท p99 2 ms
62.0k
Express15,700 req/s ยท p99 9 ms
15.7k
node:http (no framework, baseline)84,669 req/s ยท p99 2 ms
84.7k

POST + body validation

โšก JSango41,479 req/s ยท p99 4 ms
41.5k
Fastify50,585 req/s ยท p99 3 ms
50.6k
Express13,915 req/s ยท p99 10 ms
13.9k
node:http (no framework, baseline)72,288 req/s ยท p99 2 ms
72.3k

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).

24 Cohesive Monorepo Packages

Use the full stack together or pick individual packages. Each package adheres to strict zero-circular-dependency rules.

@jsango/ai AI

Provider-neutral AI agent runtime, tool validation, multi-agent workflows, RAG, and MCP.

@jsango/core Core

Application lifecycle coordinator, structured error hierarchy, and logging abstractions.

@jsango/container Core

High-performance DI container supporting transient, singleton, and scoped lifetimes.

@jsango/router Core

Segment Radix Trie router (>7.7M ops/sec) with typed constraint matching.

@jsango/http Core

Runtime-independent HTTP request/response abstractions and streaming body parsers.

@jsango/orm Data

Declarative models, AST query builder, and pure batch eager loading (.with()).

@jsango/migrations Data

Schema diffing engine, DDL compilers, distributed locks, and migration runners.

@jsango/database Data

Multi-connection manager, FIFO connection pool, and scoped transaction state machines.

@jsango/admin-ui Admin

Interactive React SPA admin dashboard with CRUD views, filters, and theme switcher.

@jsango/admin-server Admin

Admin REST orchestrator for CRUD endpoints, 2FA auth, session revoke, and export.

@jsango/admin-auth Admin

Staff authorization, resource-level CRUD permissions, and field-level visibility rules.

@jsango/auth Services

RFC 6238 TOTP 2FA engine, Session/JWT auth, Scrypt hashing, and policy RBAC.

@jsango/queue Services

At-least-once background job queues, concurrent worker polling, and dead-letter store.

@jsango/websocket Services

Multi-room WebSocket management with heartbeat monitoring and backpressure safeguards.

@jsango/openapi Services

Deterministic OpenAPI 3.1 document generation from router, validation, ORM, and Admin.

@jsango/observability Services

Structured JSON logging, Prometheus metrics, monotonic tracing, and health checks.

@jsango/cli Core

CLI developer tooling, scaffolding commands, migration generators, and dev servers.

Start Building with JSango in 60 Seconds

Scaffold a production-grade TypeScript application complete with ORM, Admin Panel, and API routing.

$ npx jsango new my-app && cd my-app && npm install && npm run makemigrations && npm run migrate && npm run dev
View Source on GitHub