v4 • v3
Build server apps that are RobustResilientFastSecure
A TypeScript framework for modular Node.js applications. Build APIs, background services, and agent integrations with dependency injection, reactive execution, and application lifecycle management.
main.ts
import 'reflect-metadata';
import {HeronJS} from '@heronjs/core';
import type {HttpOptions} from '@heronjs/common';
import {AppModule} from './app.module.js';
const app = await HeronJS.create({
module: AppModule,
runtime: {
threads: {
pools: {
cpu: {
entry: new URL('./thread/workers.js', import.meta.url),
workers: 1,
maxQueue: 64,
},
},
},
},
});
await app.listen({
port: 3000,
host: '127.0.0.1',
options: {
hooks: {
beforeHandler: [(request, reply) => {
reply.header('x-request-id', request.id);
}],
},
} satisfies HttpOptions,
});
// GET /api/health, GET /api/square/12, POST /graphql
// MCP: /mcp, ACP: /acp/review, tRPC: /trpc, WebSocket: /ws/chat
// The framework owns signal handling; scripts/tests should await app.close().HeronJS 4.1.0 · FastifyRead v4 documentation →