New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

@galaxy-stack/orbit-graphql-federation

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@galaxy-stack/orbit-graphql-federation

GraphQL Federation support for Orbit framework

latest
Source
npmnpm
Version
0.1.12
Version published
Maintainers
1
Created
Source

@galaxy-stack/orbit-graphql-federation

npm version docs

Part of the Orbit framework — a NestJS-style backend framework for Bun.

Installation

bun add @galaxy-stack/orbit-graphql-federation

@galaxy-stack/orbit-graphql-federation

Apollo Federation (v2) subgraph support for the Orbit GraphQL package — @key entities, _service/_entities federation queries, and directive generation.

Installation

bun add @galaxy-stack/orbit-graphql-federation @galaxy-stack/orbit-graphql graphql

Usage

import 'reflect-metadata';
import { FederationSchemaBuilder } from '@galaxy-stack/orbit-graphql-federation';
import { Key, External, Provides } from '@galaxy-stack/orbit-graphql-federation';
import { GraphQLObjectType, GraphQLString } from 'graphql';

@Key('upc')
class Product {}

const builder = new FederationSchemaBuilder();
builder.registerEntity(Product, new GraphQLObjectType({
  name: 'Product',
  fields: { upc: { type: GraphQLString }, name: { type: GraphQLString } },
}));
builder.registerReferenceResolver('Product', async (rep) => {
  return products.find((p) => p.upc === rep.upc) ?? null;
});

const schema = builder.buildSubgraphSchema();
// schema exposes _service { sdl } and _entities(representations)

Federation directives

Class-level: @Key(fields), @Extends(), @Shareable(), @Inaccessible(), @Tag(name), @Directive(sdl)

Property-level: @External(), @Requires(fields), @Provides(fields), @Shareable(), @Inaccessible(), @Override(from), @Tag(name)

Method-level: @ResolveReference() (alias @ReferenceResolver())

Notes

  • _entities stamps __typename on resolved entities so the _Entity union resolves even when reference resolvers omit it.
  • generateFederatedSDL prints the federated schema (including _service and _entities), so entity-only subgraphs produce valid SDL.
  • Object patterns accept both { service, rpc } (GrpcMethod decorator contract) and { service, method }.

FAQs

Package last updated on 26 Sep 2026

Related posts