dwwoelfel / oneblog-brand-new

0 stars 1 forks source link

GraphQL CLI is back! Your Swiss Army Knife for the GraphQL ecosystem #258

Open dwwoelfel opened 4 years ago

dwwoelfel commented 4 years ago

GraphQL CLI is back! Your Swiss Army Knife for the GraphQL ecosystem

Production-ready GraphQL app in seconds

TL;DR;


https://youtu.be/NDrPeQB1v5w

Overview

The GraphQL CLI provides:

  1. Helpful commands to improve your daily workflows, from starting a project to maintaining it for the long run

  2. Rich ecosystem and compatibility with libraries, editors and IDEs based on a unified graphql-config

  3. A powerful plugin system to extend GraphQL CLI with custom commands — supported by the community and The Guild

The main target of the GraphQL CLI is to provide a default entry point for the community to use proven techniques for building and deploying GraphQL enabled applications while being vendor agnostic.

Advanced developers and tool creators can extend graphql-cli to provide additional capabilities while still benefiting from a robust set of default commands for daily use — We want to use the CLI to encourage open collaborations between different tool creators.


History

Over the years the GraphQL ecosystem flourished and evolved towards more production-ready use cases with a large number of active community packages available.

GraphQL evolved thanks to the large community and the many supporting libraries it has created.

The GraphQL CLI has become a place for the community to share ideas and best practices across different solutions and libraries thanks to the push from Prisma.

The Guild took over GraphQL CLI to continue on that promise:

All of that while:


Try it out today

We’ve already refactored most of the code, created a new structure, closed and fixed all the known issues and released a new alpha version.

Install new version (follow the latest alpha in the releases page):

$ npm install graphql-cli@canary

Create a new project with GraphQL CLI by running:

$ graphql init

GraphQL CLI will guide you and after only few seconds, your project will be ready to use!


End-to-end type safety

Code generation + end-to-end type safety is a hot topic nowadays. Thanks to tools like GraphQL Code Generator we’re able to produce flexible code for both backend and frontend, just from GraphQL Schema and Operations with Fragments.

In GraphQL CLI, you get it out of the box by running:

$ graphql codegen

Discover what can be generator on GraphQL Codegen website.

Production ready GraphQL Backend

Thanks to integration with GraphBack, you’re able to produce an entire Data Base, GraphQL schema with operations and strongly typed resolvers.

$ graphql generate

Take a look at GraphBack website to learn more.

Bulletproof your GraphQL API

GraphQL CLI comes with most of the features of GraphQL Inspector.

With just few simple commands you’re able to:

$ graphql diff
$ graphql similar
$ graphql validate
$ graphql coverage
$ graphql serve

Visit GraphQL Inspector docs.


This is just the start!

The GraphQL CLI has been rewritten in order to make it extremely customizable and extensible.

Our goal is to make sure that any tool can work and benefit from this setup.

The CLI offers freedom for anyone to create any command that will extend their workflows by creating separate library. Alternatively you can open a conversation about new command that can be included into our supported set of commands.

If you prefer to use all of the Apollo toolings and products, AppSync’s solutions, Prisma, OneGraph, Hasura, Postgraphile or any other tool — we want to make the GraphQL CLI the best supporting tool for your stack.

We won’t impose any choices on the users. We want the community to lead and have template generators for any technology.

This project is completely open and free from any bias and we are open to any feedback and collaboration with anyone from the community. Please reach out!

Example use cases of GraphQL CLI

The CLI gives you the ability to build a base template with your favorite stack and tools.

Templates can be based on graphql.js, Apollo, Nexus, TypeGraphQL or anything other framework. Creating a custom template may help to enforce a specific structure that fits your product and company.

The CLI comes with two default templates that provide a seamless starting point for both backend and frontend, both could be pushed to production in a short time period.

Additionally, for existing applications, the CLI will support migrating existing databases or REST API to GraphQL.

Production-ready GraphQL app in seconds

Or “Making GraphQL easy — From nothing to a full production-ready app in 2 minutes — with any stack!”

There are many great GraphQL boilerplate repositories on available Github.

But when using those, it is often hard to adjust those to real business cases.

As an alternative to sample apps, developers can rely on frameworks that provide a high level of abstraction.

But technologies that offer rapid application development might often come at the cost of the maintenance and flexibility that can seriously limit the extensibility of your application server.

$ graphql init

We believe that making it easy to start with GraphQL is extremely important, but without sacrificing other factors like extensibility, scalability and wider control.

Simple shouldn’t equal bad architecture.

GraphQL CLI addresses this very important problem in the core by utilizing two main concepts: code generation and rich ecosystem of base templates.

The graphql init command is trying to address three simple questions:

You can think of it as a smarter create-react-app, that works on a full-stack and understands your data model.

We are calling leading boilerplate creators and frameworks to collaborate with us. We can help you expose your boilerplates also as templates for the init command.

We would also love feedback from internal infrastructure teams from companies who wish to create their own best practices and guidelines.

For more information please refer to https://github.com/aerogear/graphback

One config to rule them all — GraphQL Config

At the heart of a project created using GraphQL CLI is the GraphQL Config file. It lets the CLI know where all of the GraphQL parts are.

Config is essential for CLI templates and for the command creators that can utilize its extensibility to save additional metadata. Thanks to graphql-config, the CLI can provide seamless support for every extension and streamline development experience on top of the GraphQL CLI generated projects and corresponding templates.

For more information about GraphQL Config, you can click here to learn more.

Migration from 3.x.x to 4.x.x

We have provided a complete migration document for existing users who wish to update to the latest version of the CLI. Please keep in mind that CLI is still in the alpha phase and we are looking for the feedback before officially releasing a final version of the CLI.

Please follow https://github.com/Urigo/graphql-cli/blob/master/MIGRATION.md migration guide.


Help us to shape the GraphQL ecosystem

Start using the GraphQL CLI today!

Even though we are in an alpha phase, the CLI is fully usable and ready for the community to adopt it.

Our team is open to any suggestions and ideas for new commands.

We will support and answer all your questions on Github and on our Discord channel.

{"source":"medium","postId":"3f41cf86b8b0","publishedDate":1572531217755,"url":"https://medium.com/the-guild/graphql-cli-3f41cf86b8b0"}
dwwoelfel commented 4 years ago

Cool!