Skip to content

jelisejev/nodejs-graphql-template

 
 

Repository files navigation

Maintenance PRs Welcome Build Status TravisCI Build Status AppVeyor dependencies Status devDependencies Status

nodejs-graphql-template

Node.js, Koa, GraphQL and TypeScript template project. Batteries included 🙌

Features

  • Docker 🐳 configuration for production deployment, development and testing
  • GraphQL tools:
    • GraphQL IDL
    • Apollo Tracing
    • GraphiQL
    • GraphQL Voyager
    • GraphQL Playground
  • GraphQL Models and Connectors architecture implementation
  • CORS middleware
  • 12 Factor Configuration with .env
  • Configurable logging
    • powered by winston
  • Supercharged Development Mode
    • Incremental TypeScript builds
    • Automatic server restart on changes
    • Linting
  • Testing
    • Unit tests
    • Integration tests for GraphQL schema
  • Reporting
    • Test result export to JUnit format
    • Coverage result export to Cobertura format

Required Software

  • node >= 8.1.4 & npm / yarn

or

  • Docker >= 17.05

Install

  • npm: $ npm i
  • yarn: $ yarn
  • Docker: $ docker-compose up

Develop

  • npm: $ npm start
  • yarn: $ yarn start
  • Docker: $ docker-compose up --build

Attention windows users: when Docker for Windows is not an option, install yarn and run $ yarn && yarn docker-mount beforehand.

Regenerate GraphQL schema TypeScript types

  • npm: $ npm run g2t
  • yarn: $ yarn g2t

Test

single test run

Run unit tests

  • npm: $ npm run test:unit
  • yarn: $ yarn test:unit

Run integration tests

  • npm: $ npm run test:integration
  • yarn: $ yarn test:integration

Run all tests

  • npm: $ npm test
  • yarn: $ yarn test

Generate coverage reports

Set environment variable CI to true to generate coverage reports.

In *nix:

CI=true npm test

In Windows:

set CI=true&&npm test

In Docker:

docker-compose -f docker-compose.test.yml run -e CI=true sut

Build

$ npm run build or $ yarn build or $ docker build .

Tech Stack

About

Template project for Node.js® GraphQL APIs

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 90.6%
  • JavaScript 9.4%