Skip to content

Apollo Server

Category

Guide to using Apollo Server with Nitro GraphQL, including Federation support.

Installation

bash
pnpm add nitro-graphql@beta @apollo/server graphql graphql-config

Configuration

ts
// nitro.config.ts
import graphql from 'nitro-graphql'
import { defineNitroConfig } from 'nitro/config'

export default defineNitroConfig({
  modules: [
    graphql({
      framework: 'apollo-server',
    }),
  ],
})

Features

  • Apollo Sandbox playground
  • Federation support
  • Plugin ecosystem
  • Production-ready

Apollo Federation

ts
import graphql from 'nitro-graphql'
import { defineNitroConfig } from 'nitro/config'

export default defineNitroConfig({
  modules: [
    graphql({
      framework: 'apollo-server',
      federation: {
        enabled: true,
        serviceName: 'users-service',
      },
    }),
  ],
})

Next Steps


Source

Contributors

Changelog

26362refactor: rename defineType to defineField across documentation and examples
0.2.0 on

Released under the MIT License.