---
title: "How do I configure my Apollo Server instance to run in Federation mode?"
canonical: "https://support.apollographql.com/space/ETKB/655556662/How%20do%20I%20configure%20my%20Apollo%20Server%20instance%20to%20run%20in%20Federation%20mode%3F"
format: markdown
---
An `ApolloServer` instance automatically runs in federation mode when passed the `gateway` option during instantiation. The `gateway` option points to an object containing the gateway's configuration, which is created by instantiating a new `ApolloGateway()` (from the `@apollo/gateway` library).

Note that the option you pass in to your `ApolloServer` constructor must be named `gateway`. If your configuration object is not named `gateway`, you will need to pass in your configuration like so:

```
// gateway object.
const gatewayConfig = new ApolloGateway();

const server = new ApolloServer({
  // gateway needs needs to be declared explicitly due to the name of the config object.
  gateway: gatewayConfig,
  /// ... other options
});

```

**Full example and ****[documentation](https://www.apollographql.com/docs/federation/quickstart/setup)****.**

```
const { ApolloServer } = require("apollo-server");
const { ApolloGateway } = require("@apollo/gateway");

const gateway = new ApolloGateway();

const server = new ApolloServer({
  gateway,
  // Subscriptions are not currently supported in Apollo Federation
  subscriptions: false,
});

server
  .listen()
  .then(({ url }) => {
    console.log(`🚀 Gateway ready at ${url}`);
  })
  .catch((err) => {
    console.error(err);
  });
```