Skip to Content
HeronJS v4 is now available.
4.0.0 • 3.7.11

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 {FastifyHttpOptions} from '@heronjs/express';
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(instance) {
      instance.addHook('preHandler', async (request, reply) => {
        reply.header('x-request-id', request.id);
      });
    },
  } satisfies FastifyHttpOptions,
});
// 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.0.0 · FastifyRead v4 documentation →