Coder Social home page Coder Social logo

graphql-boilerplate's Introduction

graphql-boilerplate

Boilerplate for a scalable, production-ready GraphQL Gateway server

Features

  • Logging
  • Custom GraphQL Schema composition using graphql-delegate
  • Stackable resolvers with graphql-stack
  • Scalable application architecture
  • Authentication through JWT
  • Before and after hooks for resolvers

... much more!

Development

Initializing the Graphcool Service

cd database
gc deploy
gc info # put the simple endpoint into the `GRAPHQL_ENDPOINT` env var in .envrc
gc root-token main # put the root token into the `ADMIN_TOKEN` env var in .envrc

Starting the Gateway

yarn install
yarn start
# Open http://localhost:3000/playground

Playing around with the API

To seed some data, use gc playground and execute the following mutation:

mutation {
  createUser(
    email: "[email protected]"
    password: "abc"
    posts: [{
      title: "Post 0"
    }]
    friends: [{
      email: "[email protected]"
    	password: "abc"
      posts: [{
        title: "Post 1"
      }, {
        title: "Post 2"
      }, {
        title: "Post 3"
      }]
    }]
  ) {
    id
  }
}

Now you can login with the created user against the gateway (http://localhost:3000/playground):

mutation {
  login(email: "[email protected]" password:"abc") {
    token
  }
}

With the token, you now can check the viewer query:

{
  viewer {
    me {
      id
    }
    friendsPosts {
      id
    }
  }
}

Learning the code

We highly suggest you check out the code of the Gateway! The index.ts is a good starting point.

Community

Graphcool has a community of thousands of amazing developers and contributors. Welcome, please join us! ๐Ÿ‘‹

Contributing

Your feedback is very helpful, please share your opinion and thoughts!

+1 an issue

If an existing feature request or bug report is very important for you, please go ahead and ๐Ÿ‘ it or leave a comment. We're always open to reprioritize our roadmap to make sure you're having the best possible DX.

Requesting a new feature

We love your ideas for new features. If you're missing a certain feature, please feel free to request a new feature here. (Please make sure to check first if somebody else already requested it.)

graphql-boilerplate's People

Contributors

timsuchanek avatar schickling avatar kbrandwijk avatar devanb avatar sorenbs avatar

Watchers

James Cloos avatar

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.