Adapters
A platform may not run a plain next start server. The Deployment Adapter API
lets it customise how a Next.js app is built and deployed for its own
infrastructure. Point Next.js at the adapter in next.config.js:
// next.config.js
module.exports = {
adapterPath: require.resolve('./my-adapter.js'),
};
An adapter is a module that exports an object with two hooks. modifyConfig runs
whenever the config is loaded and can adjust it. onBuildComplete runs after the
build and receives the routes and the outputs, grouped by type — pages, app
pages, app routes, prerenders, static files, and Proxy:
const adapter = {
name: 'my-adapter',
async modifyConfig(config, { phase }) {
return config;
},
async onBuildComplete({ routing, outputs, buildId }) {
// Emit platform-specific output from `outputs`.
},
};
The adapter declares which output types it can serve. One adapter may handle only static files; another may support dynamic rendering by running routes on a Node runtime. The same public API powers every platform, and an adapter that passes the compatibility test suite is a verified adapter.
You are about to answer a short quiz on the Deployment Adapter API.