graphql-pouch icon indicating copy to clipboard operation
graphql-pouch copied to clipboard

GraphQL runtime using PouchDB

GraphQL-API runtime on top of PouchDB

Build Status Package on npm

A GraphQL-API runtime on top of PouchDB created by GraphQL shorthand notation as a self contained service with CouchDB synchronization.

Objectives - evaluating for your project

  • Frontend-First-Driven approach without backend/database migrations
  • Friendly GraphQL shorthand notation spec to create typed data model definitions fast and easy
  • Self-contained // no infrastructure dependencies // no lock in
  • Customizable for seamless integration of existing resources

Usage

First install using npm:

npm install -g graphql-pouch

and then just run it!

graphql-pouch

For more information run:

graphql-pouch -h

##GraphiQL UI for development becomes standard

GraphiQL is a awesome web based tool by Facebook to let you interactively explore your data and your API. When development mode is enabled in GraphQL-Pouch, the GraphiQL interface will be automatically displayed at your GraphQL endpoint.

Example

graphql-pouch --development
Listen on port 3000
CouchDB sync URL: none
Relay enabled: true
Development mode: true
JWT-Authentication: false

Supported GraphQL schemas:
cms initialized and running - http://127.0.0.1:3000/graphql/cms

Navigate to the URL printed to your console after starting GraphQL-Pouch and use GraphiQL to fetch your data. When you want to use GraphQL-Pouch in production mode, the GraphiQL-App is ideally suited.

GraphQL and Relay

Check out the CMS example for a demo of GraphQL-Pouch, Relay and React in action.

Benefits

GraphQL-Pouch uses the joint benefits of PouchDB and GraphQL to provide a number of key benefits.

  • 100% GraphQL compliant (supports pure GraphQL mode)
  • 100% Relay compliant
  • Command Line Interface
  • JWT Authentication support
  • Custom GraphQL-Queries and Mutations via JavaScript functions
  • Fully documented API and GraphiQL-UI for development
  • Serves multiple GraphQL schemas
  • Using GraphQL-Pouch as a NPM-Module
  • Completely self contained with Master/Master Replication
  • Supports relationships, types, comments, pagination, and more providing by GraphQL, PouchDB and CouchDB
  • Serves static files for e.g. React-Application hosting

Roadmap

In the future, things that GraphQL-Pouch will include:

  • HTTPS Support
  • Mock/Fake data results
  • Runtime traceability using resolver timings
  • Role based authorization
  • MongoDB query language inspired subselections
  • DataLoader for batching and caching optimization
  • Subscriptions using PouchDB change notifications

and, of course:

  • better documentation
  • better validation and error messages
  • better debug logs
  • more tests
  • more examples

Run Tests

npm install
npm test

Development

npm run dev

Contributors

Check them out here

Issue Reporting

If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker.

License

This project is licensed under the MIT license. See the LICENSE file for more info.

Thanks

You like this GraphQL server and you want to see what coming next? Follow me on Twitter @mikebild.

Enjoy!

Credits

Thanks to Matthew Mueller for his initial work on graph.ql which laid the groundwork for the GraphQL shorthand notation parser module.