Skip to main content


First, you need to ensure you have the libs installed, so run this code:

npm i --save fastify

Then, you need you just need to use the FastifyFramework when you create your adapter, like:

import { ServerlessAdapter } from '@h4ad/serverless-adapter';
import { FastifyFramework } from '@h4ad/serverless-adapter/frameworks/fastify';

const Fastify = require('fastify');

const app = Fastify({ logger: true });
export const handler =
.setFramework(new FastifyFramework())
// continue to set the other options here.
//.setHandler(new DefaultHandler())
//.setResolver(new PromiseResolver())
//.addAdapter(new AlbAdapter())
//.addAdapter(new SQSAdapter())
//.addAdapter(new SNSAdapter())
// after put all methods necessary, just call the build method.

Is your application instance creation asynchronous? Look the LazyFramework which helps you in asynchronous startup.


Need to deal with CORS? See CorsFramework which helps you to add correct headers.