Launch GraphOS Studio
Apollo Server 3 is officially deprecated, with end-of-life scheduled for 22 October 2024. Learn more about upgrading to a supported Apollo Server version.

Built-in plugins

Plugins extend 's functionality by performing custom in response to certain events. These events correspond to individual phases of the request lifecycle, and to the lifecycle of Apollo Server itself.

Certain Apollo Server features are provided as built-in plugins that are exported from apollo-server-core (or another library that's distributed with apollo-server). Apollo Server installs certain plugins automatically, but you can also install them manually to override their default settings. See each plugin's documentation for details.

You can also create custom plugins.

List of built-in plugins

Usage reportingapollo-server-coreGathers helpful operation usage data and reports it to Apollo Studio for visualization, alerting, and more.
Schema reportingapollo-server-coreAutomatically reports the server's schema to Apollo Studio on startup to enable schema history and up-to-date metrics.
Inline traceapollo-server-coreUsed primarily by federated subgraphs to include operation trace data in responses to the gateway.
Cache controlapollo-server-coreCalculates caching behavior for operation responses.
Landing page (multiple)apollo-server-coreHandle displaying a default or custom landing page at Apollo Server's base URL.
Response cacheapollo-server-plugin-response-cacheCaches operation responses in a back-end store (in-memory, Redis, etc.)

Installing plugins

You can install a plugin that isn't installed by default (or customize a default plugin) by providing a plugins configuration option to the ApolloServer constructor, like so:

import { ApolloServer } from "apollo-server";
import {
} from "apollo-server-core";
const server = new ApolloServer({
csrfPrevention: true,
cache: "bounded",
plugins: [
// Sets a non-default option on the usage reporting plugin
sendVariableValues: { all: true },
ApolloServerPluginLandingPageLocalDefault({ embed: true }), // recommended
Usage reporting
Edit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc.

Privacy Policy