Skip to content

mgagliardo91/postgraphile-federation-plugin

This branch is 520 commits ahead of, 24 commits behind graphile/federation:main.

Folders and files

NameName
Last commit message
Last commit date
Oct 25, 2021
Oct 6, 2021
Oct 14, 2021
Oct 5, 2021
Feb 28, 2022
Oct 5, 2021
Oct 5, 2021
Oct 5, 2021
Oct 6, 2021
Oct 5, 2021
Oct 5, 2021
Oct 5, 2021
Oct 5, 2021
Oct 14, 2021
Oct 25, 2021
Jun 29, 2019
Mar 21, 2022
Oct 5, 2021
Oct 5, 2021
Jul 29, 2024
Apr 8, 2024
Oct 5, 2021

Repository files navigation

@graphile/federation

Package on npm MIT license CI

Apollo federation support for PostGraphile (or any Graphile Engine schema).

NOTE:

This repository is forked from https://github.com/graphile/federation which is currently unmaintained. While this repository will not be in active development with new features, all contributions and pull requests are welcome and will be reviewed in a timely manner.

Maintaining this fork was a preference from the original owners of the federation repository See Issue 39.

Installation

npm install postgraphile postgraphile-federation-plugin

CLI usage

postgraphile --append-plugins postgraphile-federation-plugin

Library usage

const express = require("express");
const { postgraphile } = require("postgraphile");
const { default: FederationPlugin } = require("postgraphile-federation-plugin");

const app = express();
app.use(
  postgraphile(process.env.DATABASE_URL, "public", {
    appendPlugins: [FederationPlugin],
  })
);
app.listen(process.env.PORT || 3000);

How?

This plugin exposes the Global Object Identification Specification (i.e. Node interface) in a way that's compatible with Apollo Federation.

Requires PostGraphile v4.4.2-rc.0+ and a maintained LTS version of Node.

Testing

Docker can be used to spin up a test instance for running Jest tests. The instance will be exposed at port 5432. See .env.example for the exported Postgre connection.

docker compose up -d
./scripts/test

Do you need this?

Only use this if you're planning to have your API consumed by Apollo Federation; exposing these redundant interfaces to regular users may be confusing.

Status

Proof of concept. No tests, use at your own risk! Pull requests very welcome.

Packages

No packages published

Languages

  • TypeScript 97.4%
  • Shell 1.5%
  • JavaScript 1.1%