Git Product home page Git Product logo

create-graphql-guru's Introduction

Create GraphQL Guru

Easily Scaffold and generate graphql servers

Features

  • Scaffolding a full server
  • Dynamic imports
  • Structureless modules
  • Multiple pluggable database clients
  • Resolver caching
  • Schema and query validation
  • IDE and admin tools
  • Do just enough and step out the way

Databases

While any database can be used with GraphQL Guru, the following perbuilt resolvers have been created for convenience:

Quick overview


guru express my-server  
cd my-server  
npm run dev

Get Started Immediately

You don’t need to install or configure tools like Webpack or Babel. They are preconfigured and hidden so that you can focus on the code.

Just create a project, and you’re good to go.

Getting started

Installation

Install once globally:

npm install -g create-graphql-guru

You will need Node >= 6 on your machine. You can you n or nvm

Creating a server

To create a new server, run:

guru express my-server

cd my-server
npm run dev  

It will create a directory called my-server inside the current folder.
Inside that directory, it will generate the initial project structure and install the transitive dependencies:

my-server
├── bin
│   └── www
│       └── index.js
├── node_modules
├── public
├── server
│   ├── core
│   │   ├── database
│   │   ├── middleware
│   │   │   └── index-middleware.js
│   │   ├── routes
│   │   │   └── index-routes.js
│   │   └── database.js 
│   ├── modules
│   │   └── resolverQuery-hello.js 
│   │   └── schemaQuery-hello.graphql 
│   │   └── schemaType-hello.graphql 
│   │   └── access.js 
│   ├── queries
│   ├── views
│   │   └── layout 
│   │   └── index.hbs 
│   ├── environment.js
│   └── index.js
├── LICENSE
├── package.json
├── query-history.json
├── README.md
└── yarn.lock

No configuration or complicated folder structures, just the files you need to build your app. Once the installation is done, you can run some commands inside the project folder:

npm run dev or yarn run dev

Generating files

Types

guru type generate type definition.

Example

guru type  -m User -e "Enum USER GUEST" -o "User name:string lastName:String age:Int" 
 Usage: guru type [options]

Options:

  -m, --module <name>                 Module name
  -p, --path                          Path to where module will be created, relative to root.
  -e, --enum ["name value"]           creates Enum definition
  -f, --interface ["name key:value"]  interface definition
  -i, --input ["name key:value"]      input definition
  -o, --object ["name key:value"]     Object definition
  -s, --scalar ["name key:value"]     Scalar definition
  -u, --union ["name key:value"]      creates Union definition
  -h, --help                          output usage information

Queries

guru query generates resolver and schema queries.

Example

guru query -m User -d 'mongodb' -rs 'User' findAll findById

Query options

Usage: guru query [options]

Options:

  -m, --module <name>    Modules name
  -d, --database <name>  Extends module with database client
  -r, --resolver [true]  Create mutation resolve
  -s, --schema [true]    Name of query module
  -p, --path             Path to where module will be created, relative to root.
  -h, --help             output usage information

Mutations

guru mutation generates resolver and schema queries.

Example

guru mutation -m query -d 'mongodb' -rs 'User' create update remove

Mutation options

Usage: guru-mutation [options]

Options:

  -m, --module <name>    Modules name
  -d, --database <name>  Extends module with database client
  -r, --resolver [true]  Create mutation resolve
  -s, --schema [true]    Name of query module
  -p, --path             Path to where module will be created, relative to root.
  -h, --help             output usage information

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.