CanxJS includes advanced performance features like JIT compilation and request batching out of the box.
Compiles routes to regex for zero-overhead matching.
Combine multiple API calls into a single HTTP request.
Automatically remove duplicate requests in a batch.
Optimized for Bun's high-performance runtime.
Reduce HTTP overhead by combining multiple API operations into a single request.
1import { createBatcher } from "canxjs";23const batcher = createBatcher({4batchWindow: 50, // Collect requests for 50ms5maxBatchSize: 100,6dedupe: true // Remove duplicate identical requests7});89// Usage in controller10@Post('batch')11async handleBatch(@Body() requests: any[]) {12return await batcher.processBatch(requests, async (req) => {13// Process individual request14return await this.service.handle(req);15});16}
CanxJS automatically compiles your routes into optimized Regular Expressions. No configuration needed.
1import { jitCompiler } from "canxjs";23// JIT is automatic, but you can inspect stats4const stats = jitCompiler.getStats();5console.log(stats);6// { compiledRoutes: 15, cacheHits: 12050, avgCompileTime: 0.05 }