Skip to content

devhttps/graphpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

☄️ A minimalistic zero-config GraphQL server

Check out the demo on CodeSandbox: https://codesandbox.io/s/k3qrkl8qlv

What is included

Graphpack utilizes webpackwith nodemon and lets you create GraphQL servers with zero configuration. It uses Apollo Server under the hood, so we get features like GraphQL Playground, GraphQL Imports and many more right out of the box.

  • 📦 Zero-config out of the box experience
  • 🚦 Built-in Live reload and automatic recompilation
  • 🚨 Super-friendly error messages
  • 🎮 GraphQL Playground IDE
  • ⭐️ GraphQL imports in Schema Definition Language
  • 🔥 Blazing fast bundle times
  • ⚡️ ES module imports thanks to Babel

Install

With yarn:

yarn add --dev graphpack

With npm:

npm install --save-dev graphpack

Usage

Add entry files: src/schema.graphql & src/resolvers.js

Add your type definitions under src/schema.graphql and add some example types in SDL:

type Query {
  hello: String
}

Add your resolvers under src/resolvers.js:

const resolvers = {
  Query: {
    hello: () => 'world!',
  },
};

export default resolvers;

Graphpack can resolve both .js and .graphql files. This means you can use any of these folder/file structure:

  • src/resolvers.js
  • src/resolvers/index.js
  • src/schema.js
  • src/schema/index.js
  • src/schema.graphql
  • src/schema/index.graphql

Setup npm run scripts

Add following run scripts to your package.json:

  "scripts": {
    "build": "graphpack build",
    "dev": "graphpack"
  },

Start dev server:

yarn dev

Create a production build

yarn build

Start production build

Simply run the build command and start the app

yarn build
node ./build/index.js

CLI Commands

graphpack (alias graphpack dev)

Runs graphpack in development mode.

graphpack build

Creates a production ready build under the project roots build folder.

Make sure to run yarn build before.

Entry files

tbd

src/resolvers.js (required)

tbd

src/schema.js (required)

tbd

src/context.js

tbd

src/config.js

tbd

Customize configuration

tbd

Webpack

tbd

Apollo Server

tbd

Acknowledgements

Graphpack was heavily inspired by:

License

MIT

About

☄️ A minimalistic zero-config GraphQL server.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%