Socket
Book a DemoInstallSign in
Socket

@envelop/apollo-federation

Package Overview
Dependencies
Maintainers
2
Versions
1432
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@envelop/apollo-federation

This plugin integrates Apollo Federation Gateway into Envelop.

latest
Source
npmnpm
Version
7.0.0
Version published
Maintainers
2
Created
Source

@envelop/apollo-federation

This plugin integrates Apollo Federation Gateway into Envelop.

Getting Started

yarn add @envelop/apollo-federation

Usage Example

import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import { ApolloGateway } from '@apollo/gateway'
import { useApolloFederation } from '@envelop/apollo-federation'
import { envelop, useEngine } from '@envelop/core'

// Initialize the gateway
const gateway = new ApolloGateway({
  serviceList: [
    { name: 'accounts', url: 'http://localhost:4001' },
    { name: 'products', url: 'http://localhost:4002' }
    // ...additional subgraphs...
  ]
})

// Make sure all services are loaded
await gateway.load()

// Then pass it to the plugin configuration
const getEnveloped = envelop({
  plugins: [
    useEngine({ parse, validate, specifiedRules, execute, subscribe }),
    // ... other plugins ...
    useApolloFederation({ gateway })
  ]
})

FAQs

Package last updated on 20 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts