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

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

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
๐Ÿ–ฅ๏ธ

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

Engineered for High-Concurrency Workloads

Zero reflection on hot paths, segment radix tree matching, and zero-allocation body streaming deliver outstanding real-world performance.

>7.7M
Route Lookups / sec
0.02ms
P99 Router Latency
0
Runtime Reflection Overhead
100%
Strict TypeScript Safety
โšก JSango SegRadix Router 7,720,000 ops/sec
100%
Fastify Find-My-Way 5,410,000 ops/sec
70%
Express Path-To-Regexp 1,250,000 ops/sec
16%

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/cli create my-app && cd my-app && pnpm dev
View Source on GitHub