Usage Chart
How strongly this package shapes the runtime
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
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