Very simple boilerplate using GraphQL and DataLoader
Switch branches/tags
Clone or download
Latest commit 4774a78 Dec 4, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci ci(flow): add flow.log to artifacts Aug 19, 2018
data chore(schemas): update schemas Aug 19, 2018
flow-typed/npm correct dependency for eslint from airbnb May 14, 2018
repl first version boilerplate Oct 1, 2016
scripts first version boilerplate Oct 1, 2016
src fix mongoose deprecation warnings Oct 22, 2018
test fix URL string parser deprecation warning Oct 8, 2018
.env feat(circleci): re-add CircleCI, and add message to .env Aug 19, 2018
.env.example Update .env.example Aug 19, 2018
.eslintrc feat(ts): move user module to ts Sep 9, 2018
.flowconfig feat(parallel-tests): allow for parallel testing on jest May 13, 2018
.gitignore feat(tests): improve tests settings to use separated files Aug 19, 2018
.nvmrc add yarn autoclean, for to use 'yarn autoclean --force' Jan 5, 2018
.yarnclean update libraries and add ignore istanbul assets Jan 5, 2018
Dockerfile Update Dockerfile Nov 30, 2017
LICENSE feat(license): add MIT license Aug 19, 2018
README.md Change to yarn Dec 3, 2018
babel.config.js fix(ts): fix ts config Sep 13, 2018
docker-compose.test.yml test on docker Aug 16, 2017
docker-compose.yml As the issue #51 were opened requesting the docker support for this b… Jul 25, 2017
jest-eslint.config.js feat(tests): improve tests settings to use separated files Aug 19, 2018
jest-test-eslint.config.js feat(tests): improve tests settings to use separated files Aug 19, 2018
jest-test.config.js feat(tests): improve tests settings to use separated files Aug 19, 2018
jest.config.js feat(ts): incrementally add ts Sep 8, 2018
nodemon.json feat(ts): incrementally add ts Sep 8, 2018
package.json Change to yarn Dec 3, 2018
repl.js update and fix all Mar 15, 2018
tsconfig.json fix(ts): disable generic on ts for now Sep 11, 2018
yarn.lock Fix yarn.lock Dec 3, 2018

README.md

GraphQL DataLoader Boilerplate

CircleCI codecov

Boilerplate using GraphQL and DataLoader

⭐️ TypeScript ⭐️

Check it out TS version of this boilerplate: https://github.com/entria/graphql-dataloader-boilerplate-ts

Blog Posts

Directory Structure

├── /data/                   # GraphQL generated schema
├── /repl/                   # Read-Eval-Print-Loop (REPL) configuration
├── /scripts/                # Generate GraphQL schema script
├── /src/                    # Source code of GraphQL Server
│   ├── /core/               # Core types and helper files, can be used like a global module
│   ├── /interface/          # NodeInterface (Relay) and other GraphQL Interfaces
│   ├── /modules/            # Modules (think on modules like isolated pieces of your code)
│   │   │── /mutation/       # Module mutations (add an index file to be used on MutationType)
│   │   │── /subscription/   # Module subscriptions (add an index file to be used on SubscriptionType)
│   │   │── /enum/           # Enums related to this module
├── /test/                   # Test helpers

Create-GraphQL

If you want to move faster you should use create-graphql to simplify the creation of a GraphQL Server

Command

Setup

yarn install

Note: If you do not have mongodb installed, please install it:

brew install mongodb

Develop

yarn watch

Test

yarn test

Or

yarn test:watch

Docker and docker-compose

No needs for installing dependencies or running mongod in another terminal window

docker-compose build && docker-compose up

Test

docker-compose -f docker-compose.test.yml build && docker-compose -f docker-compose.test.yml up

Production

# first compile the code
yarn build

# run graphql compiled server
yarn start

Flow

yarn flow

Or

flow

REPL server

yarn repl

awesome > const user = await M.User.find()

Yep, await syntax works on the repl, it is awesome, tks @princejwesley (https://gist.github.com/princejwesley/a66d514d86ea174270210561c44b71ba)

Schema

Update your schema

yarn update-schema

Take a look on the Schema