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 🙏

© 2025 – Pkg Stats / Ryan Hefner

contentry

v1.0.12

Published

Expose WordPress through GraphQL

Readme

Contentry

Highly extensible GraphQL read APIs for the WordPress blog platform.

Build Status Node Version NPM Version NPM Downloads

By reading directly from the MySQL database, this library allows you to make the WordPress webserver externally inaccessible and expose the content to your UI via GraphQL. This integration model makes it the perfect partner for a Progressive Web App built using a technology such as ReactJS.

// import into your own application
import Contentry from 'contentry';

const options = { /* ... */ }; // e.g. load in from config file

// create the app
const contentry = new Contentry(options);

or

# run as a standalone server
$ npm start

Getting Started

Contentry can operate in one of two modes - either as a wrapper around a set of GraphQL types, schemas and resolvers which you can load into your own GraphQL server, or a standalone server that makes it really easy to get up and running straight away.

Import into your own application

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 8.9.0 or higher is required.

Installation is done using the npm install command:

$ npm install contentry

Run as a standalone server

The ./lib/server.js file will spin up a web server using koa to expose a GraphQL at /graphql and optionally a GraphiQL UI at /graphiql. This command is tied to the npm scripts so you can start the server by running:

$ npm start

The configuration is intended to provide sensible defaults, but you can override these easily by changing the configuration in the ./config/ folder. You can also pass in environmental variables to provide access to the MySQL database powering WordPress.

Environmental Variables

The following environmental variables are available to configure access to the database:

| Environment Variable | Default Value | Notes | | -------------------- | ------------- | ----- | | MYSQL_HOSTNAME | localhost | MySQL database hostname | | MYSQL_USERNAME | root | MySQL user with read permissions to the WordPress database | | MYSQL_PASSWORD | [empty] | Password for the MySQL user | | MYSQL_DATABASE | wordpress | WordPress database name | | MYSQL_TABLE_PREFIX | wp_ | Prefix for the table names within the WordPress database |

GraphQL Server

The application is a wrapper around a set of GraphQL schemas and types, along with resolvers which retrieve data directly from the WordPress database.

If you are using the server directly then by default it exposes an HTTP server on port 3000. This can be changed with the options key server.port passed into the application constructor and defined in the config file.

The data are then made available as a GraphQL API at:

http://localhost:3000/graphql

There is also a GraphiQL UI for navigating the GraphQL API available at:

http://localhost:3000/graphiql

API

The API is intended to be discoverable, and can be easily browsed using the GraphiQL endpoint.

Events

The application does emit some events. Until these are thoroughly documented, you can see the full list of these by binding to the * event as follows:

contentry.on('*', console.log);

To Do

  • Add documentation for:
    • GraphQL Schema and Types
    • Field and metadata enabling / disabling
    • Configuration file
  • Add significantly more unit tests

Future Roadmap

  • Explore use of DataLoaders and caching to improve performance
  • Authentication / authorization for accessing privileged content (unpublished posts, private settings, etc)
  • Build interface to allow easy integration of plugins
  • Support for WordPress plugins
  • Webhooks for invalidating cache / updating websocket connections
  • Mutations