Usage Chart
How strongly this package shapes the runtime
Package Flow
How this package moves through xtaskjs runtime phases
Before startup
Create a Fastify instance with your preferred logger and plugins before wiring it into the framework adapter.
During CreateApplication()
The Fastify adapter translates the shared xtaskjs controller contract into Fastify routes, static assets, and template lookups.
During app.close()
Shutdown flows through the application close sequence so Fastify resources stop together with the rest of the xtask lifecycle.
API Surface
Representative exports from the upstream package
Adapter runtime
- FastifyAdapter
- view
- HttpAdapter
- HttpRequestHandler
Request and response types
- HttpRequestLike
- HttpResponseLike
- HttpServerOptions
- HttpViewResult
- HttpAdapterType
Adapter options
- FastifyAdapterOptions
- FastifyTemplateEngineOptions
- FastifyStaticFilesOptions
Usage
Typical adoption flow
1. Create the Fastify app
Start from a Fastify instance when you want lower-level performance tuning or plugin-driven composition.
2. Wrap it with the adapter
Pass new FastifyAdapter(fastifyApp) into CreateApplication() to keep the same controller surface used by node-http and Express.
3. Add persistence or views
Pair the adapter with TypeORM or file-backed views without rewriting route handlers or service classes.
Example
Reference snippet
import fastify from "fastify";
import { CreateApplication } from "@xtaskjs/core";
import { FastifyAdapter } from "@xtaskjs/fastify-http";
const fastifyApp = fastify({ logger: true });
await CreateApplication({
adapter: new FastifyAdapter(fastifyApp),
autoListen: true,
server: { host: "127.0.0.1", port: 3000 },
});
Samples
Official samples to inspect next
Reference samples: 03-fastify_app and 04-typeorm_app
Related
Packages commonly used with this one