xTaskjs 1.0 is live: role-based accounts, documentation, and a customizable interface.

Packages

@xtaskjs/core

Bootstrap, kernel, DI container, lifecycle, and HTTP application primitives.

npm install @xtaskjs/core reflect-metadata Package path: packages/core

Overview

What this package owns in the runtime

Core owns application startup. It boots the kernel, scans components, resolves adapters, and coordinates optional integrations like TypeORM and security during CreateApplication().

What it provides

  • CreateApplication() bootstraps lifecycle + kernel + adapter in one entry point.
  • Container autoloads decorated classes and resolves constructor dependencies.
  • ApplicationLifeCycle dispatches guards, pipes, middlewares, handlers, and lifecycle events.
  • HTTP layer normalizes adapters and view results across node, Express, and Fastify.

How it fits

  • Works alone with the default node-http adapter.
  • Delegates server integration to @xtaskjs/express-http or @xtaskjs/fastify-http.
  • Initializes @xtaskjs/typeorm and @xtaskjs/security when those packages are present.

Usage Chart

How strongly this package shapes the runtime

Bootstrap

5/5

Dependency Injection

5/5

HTTP Delivery

5/5

Rendering

4/5

Integrations

5/5

Package Flow

How this package moves through xtaskjs runtime phases

Before startup

Import reflect-metadata and decorate controllers, services, and runners so the kernel can discover them during bootstrap.

During CreateApplication()

Core builds the application lifecycle, selects the HTTP adapter, loads the DI container, and initializes optional integrations such as TypeORM, security, mailer, scheduler, and internationalization.

During app.close()

Core emits shutdown lifecycle events, closes the active adapter, and asks installed integrations to release resources in a predictable order.

API Surface

Representative exports from the upstream package

Bootstrap and app

  • CreateApplication
  • Bootstrap
  • XTaskHttpApplication
  • createHttpAdapter

DI and components

  • Component
  • Service
  • Controller
  • Repository
  • AutoWired
  • Qualifier
  • PostConstruct
  • PreDestroy

HTTP primitives

  • HttpAdapter
  • HttpRequestLike
  • HttpResponseLike
  • HttpViewResult
  • view
  • NodeHttpAdapter
  • FastifyAdapter

Usage

Typical adoption flow

1. Install and import

Install @xtaskjs/core with reflect-metadata and use CreateApplication() as the single bootstrap entry point.

2. Pick an adapter

Start with node-http for the smallest runtime, or pair core with Express or Fastify adapters when you need ecosystem-specific middleware or rendering.

3. Layer integrations later

Add persistence, security, mail, localization, or scheduled jobs without changing the controller and DI patterns you started with.

Example

Reference snippet

Minimal application bootstrap
import "reflect-metadata";
import { CreateApplication } from "@xtaskjs/core";

async function main() {
  await CreateApplication({
    adapter: "node-http",
    autoListen: true,
    server: { host: "127.0.0.1", port: 3000 },
  });
}

main().catch(console.error);

Samples

Official samples to inspect next

Reference samples: 01-new_app, 02-express_app, 03-fastify_app, 04-typeorm_app, 06-security_app, 07-security_express_app

Related

Packages commonly used with this one