A helper library for defining GraphQL schemas around BookshelfJS models with automatic relationship mapping.
GraphQL Bookshelf is a helper library that bridges BookshelfJS models with GraphQL schemas. It automates the mapping of model attributes and relationships to GraphQL fields, reducing the need for repetitive resolve functions. The library provides utilities like `model.attr()`, `model.belongsTo()`, and `model.hasMany()` to streamline schema definition and optimize database queries.
Node.js developers using BookshelfJS as their ORM who want to expose their data models through a GraphQL API with minimal boilerplate.
It eliminates repetitive code by automatically handling relationship resolution and attribute mapping, while still offering flexibility through direct query builder access. Unlike full schema generators, it keeps control in the developer's hands for complex use cases.
Some help defining GraphQL schema around BookshelfJS models
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses model.attr() to eliminate manual resolve functions for simple fields, as shown in the example where id is mapped without a resolve function.
Provides model.belongsTo() and model.hasMany() to automatically resolve one-to-one and one-to-many associations, reducing boilerplate for relationships like subject and students.
Offers direct access to KnexJS query builder in resolve functions, enabling custom sorting and filtering, such as ordering homeworks by created_at in the example.
Supports graphql-relay-js for defining connection types and arguments, easing integration with Relay as demonstrated in the homeworks field.
The README labels it as an 'early version', indicating potential instability, limited features, and fewer updates or community contributions.
Heavily dependent on BookshelfJS, making migration or use with other ORMs difficult and restricting it to specific database setups like Postgres mentioned in the description.
Focuses on basic CRUD and relationships; lacks built-in support for mutations, subscriptions, or complex query optimizations beyond the provided hooks.