cga

create-graphql-app

Cli tool for bootstrapping serverless GraphQL api

Showing:

Popularity

Downloads/wk

7

GitHub Stars

28

Maintenance

Last Commit

2yrs ago

Contributors

1

Package

Dependencies

10

License

MIT

Type Definitions

Built-In

Tree-Shakeable

Yes?

Categories

Readme

create-graphql-app

Build Status Coverage Status npm MIT licensed code style: prettier semantic-release renovate-app badge

Cli tool for bootstrapping production grade GraphQL server, using:

  • typescript
  • apollo-server 2
  • graphql-code-generator
  • merge-graphql-schemas
  • Dependency injection with injection-js

Installation

Please make sure you have Node.js version 8+, and type

npm install -g create-graphql-app

CLI commands

Init server command

Open shell in the desired folder for bootstrapping the server, and typed:

cga init <project-name>

The command will prompt available server seeds options. Choose the boilerplate project you want, and start coding!

Generate server resolver files

The server boilerplate code is designed as multi file schema definitions. Our recommended way for schema design is to create a type file for certain entity. Eventually, all entities schemas are merged. To generate a matching resolver file for type file, execute the command:

cga r <type-file> <resolver file>

This will create a matching file, with all Query, Mutation and Subscription definitions.

Generate services

Our server resolvers should operate as a thin layer, or controller, that links between the schema, and the server business logic. We use services for our model, to perform logic such as api fetching, db operations, etc. In order to create a new service, run the command:

cga s <service-path> [--ignoreContext]

This will create a new service file to services directory. Also, it will register the service on the server injector file, and will add its definition to the context object, thus allowing its usage by resolvers. You can exclude context file additions by passing the ignoreContext flag.

Deploy server to production

Inside the project directory, type:

cga d

This will run the server deploy script, and will move the server to production! 🚀

Extended documentation

Please check out the extended documentation for more information

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial