Back to Apollo Server

How do the Apollo Server landing pages work?

packages/server/README_landingpages.md

1.4.13.8 KB
Original Source

How do the Apollo Server landing pages work?

If users don't manually install any plugin that implements renderLandingPage, Apollo Server does the following by default:

  • In non-production environments (NODE_ENV is not production), Apollo Server installs ApolloServerPluginLandingPageLocalDefault.
  • In production environments (NODE_ENV is production), Apollo Server installs ApolloServerPluginLandingPageProductionDefault.

Non-embedded landing page

The ApolloServerPluginLandingPageProductionDefault shows a minimalist landing page:

This landing page is rendered via a script tag in the index of the landingPage directory. This tag references a CDN upload that contains the built version of the contents of the studio-landing-page repo. This repo uploads versioned and latest CDN bundles on merge to main.

Configuration params are passed from the user defined config in Apollo Server to the CDN bundle via window.landingPage. They are consumed in the studio-landing-page repo here.

Embedded landing pages

Embedded local dev

The ApolloServerPluginLandingPageLocalDefault shows an embedded Sandbox:

The embedded Sandbox is rendered via a script tag in the index of the landingPage directory. This tag references a CDN upload that contains the built version of the contents of the @apollo/sandbox package in the embeddable-explorer repo. This repo uploads versioned and latest CDN bundles on merge to main.

Configuration params are passed to the window.EmbeddedSandbox instance which creates an EmbeddedSandbox instance.

Embedded production with graphRef

The ApolloServerPluginLandingPageProductionDefault, when configured with a graphRef, shows an embedded Explorer.

The embedded Explorer is rendered via a script tag in the index of the landingPage directory. This tag references a CDN upload that contains the built version of the contents of the @apollo/explorer package in the embeddable-explorer repo. This repo uploads versioned and latest CDN bundles on merge to main.

Configuration params are passed to the window.EmbeddedExplorer instance which creates an EmbeddedSandbox instance.