npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@foo-software/ghost-graphql

v3.1.1

Published

Apollo GraphQL data sources, query resolvers, schemas, and types for Ghost

Downloads

135

Readme

@foo-software/ghost-graphql

GraphQL data sources, query resolvers, schemas, and types for Ghost. This project provides the pieces to power an Apollo Server. @foo-software/ghost-graphql-server package imports modules from this project to provide an Apollo Server class with pre-defined options. You should use that project for a simple, quick solution if you don't need much customization. The exports of this package could be used in a custom implentation instead of using @foo-software/ghost-graphql-server. Includes types for TypeScript support (this project is written in TypeScript as a matter of fact).

Table of Contents

Getting Started

Below are steps to get started with a custom implementation. If you're looking to spin up a standalone server, check out the guide here instead.

TypeScript Dependencies

We use tsc to generate types and you may need to match our TypeScript version if you have build errors. Check our package.json to find our TypeScript version.

Ghost Content API

All queries fetch from Ghost's Content API.

Pagination and Filtering

Resolvers with pagination and filter arguments can be found by inspecting the schema. Arguments mirror the parameters as documented.

Resources with pagination respond with a list of edges loosely based on the GraphQL connection spec provided by Relay. Pagination does not support cursors for the time being due to limitations from Ghost's Content API.

Filter Expressions

Filtering has evolved a bit in this project. We initially provided a filter argument which is an array of string type ([String]), however this led to unintuitive behavior as described in issue #8. Typing it in this way was naive in that it adds an or operator with multiple filters like filter: ["feature:true", "tag:some-tag"].

In order to leverage the full power of Ghost's filter expression syntax, it's best to now use the filterExpression argument (String type) instead of the original filter argument.

For example, if I wanted to fetch all feature posts and exclude tags with some-tag, I would use filterExpression like so:

filterExpression: "featured:true+tag:-some-tag"

Note the use of the and operator (+) and negation operator (-).

Custom Implementation Example

In most custom implementations, you'll only need to import resolvers. For implementations that are more complicated - it is possible to import any part of this package, including data sources, types, etc - just take a look at what is exported.

Before following the example below, make sure you've setup environment variables per the getting started guide.

Example

Example assuming you've setup a server similar to the example found in Apollo Server docs.

import {
  authorResolver as author,
  AuthorsDataSource,
  authorsResolver as authors,
  pageResolver as page,
  pagesResolver as pages,
  PagesDataSource,
  postResolver as post,
  postsResolver as posts,
  PostsDataSource,
  settingsResolver as settings,
  SettingsDataSource,
  tagResolver as tag,
  TagsDataSource,
  tagsResolver as tags,
} from '@foo-software/ghost-graphql';

const server = new ApolloServer({
  resolvers: {
    Query: {
      author,
      authors,
      page,
      pages,
      post,
      posts,
      settings,
      tag,
      tags,
    },
  },
  dataSources: () => {
    return {
      authorsDataSource: new AuthorsDataSource(),
      pagesDataSource: new PagesDataSource(),
      postsDataSource: new PostsDataSource(),
      settingsDataSource: new SettingsDataSource(),
      tagsDataSource: new TagsDataSource(),
    };
  },
  context: () => {
    return {
      token: 'foo',
    };
  },
});

Environment Variables

Schema

The schema structure can be seen in schema.graphql of the @foo-software/ghost-graphql package.