Launch Apollo Studio

Built-in plugins


Plugins extend Apollo Server's functionality by performing custom operations in response to certain events. These events correspond to individual phases of the GraphQL 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

NameLibraryDescription
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 { ApolloServerPluginUsageReporting } from "apollo-server-core";

const server = new ApolloServer({
  typeDefs,
  resolvers,
  plugins: [
    // Sets a non-default option on the usage reporting plugin
    ApolloServerPluginUsageReporting({
      sendVariableValues: { all: true },
    }),
  ],
});
Edit on GitHub