Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-sequelize-generator

Package Overview
Dependencies
Maintainers
2
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-sequelize-generator

A set of tools to easily generate a Graphql API from sequelize models.

  • 7.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
36
decreased by-21.74%
Maintainers
2
Weekly downloads
 
Created
Source

Graphql-Sequelize-Generator

Graphql-Sequelize-Generator (GSG) is a set of tools that will allow you to easily generate a GraphQL API from your sequelize models.

It's a very good fit for POCs and MVPs, while also scaling pretty well thanks to dataloader-sequelize.

Manual

Get started with the online documentation

What can I do with GSG?

The tools provided by this library will allow you to:

  • Query any model defined in your app through GraphQL.
  • Auto-generate create/update/delete mutations.
  • Define before/after hooks and all resolvers, including the mutations.
  • Easily create custom mutations.
  • Get an integrated interface to test your GraphQL API.
  • Counts for each model can also be generated.
  • Subscriptions auto-generated for mutations.
  • Add custom fields/resolvers on auto-generated types.
  • Easy integration with dataloader-sequelize

Getting started

Add the lib and the peer dependencies:

$ yarn add graphql-sequelize-generator graphql sequelize graphql-sequelize

⚠️ Caution: GSG requires at least Node v9.11.2 or greater as it is using async/await.

Then you will be ready to add a GraphQL API to your express server with only a few lines of code:

import express from 'express'
const {
  generateModelTypes,
  generateGraphqlExpressMiddleware
} = require('graphql-sequelize-generator')
import models from './models'

const types = generateModelTypes(models)

graphqlSchemaDeclaration.user = {
  model: models.user,
  actions: ['list', 'create']
}

const server = generateApolloServer({
  graphqlSchemaDeclaration,
  types,
  models
})

const app = express()
server.applyMiddleware({
  app,
  path: '/graphql'
})

Getting started with boilerplates

You can easily start a project with graphql-sequelize-generator using these boilerplates:

Keywords

FAQs

Package last updated on 10 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc