GraphQL CLI is back!
Explore our services and get in touch.
- GraphQL CLI is a popular command-line tool providing various tools for creating and maintaining GraphQL based applications
- Prisma recently transferred the project to The Guild — and we completely rewrote it and closed over 100 issues
- We've already fixed and added many commands, but we are looking to learn and integrate with tools and companies across the ecosystem!
- You can now generate a full stack working app, from a GraphQL schema model, in 2 minutes using the init+generate commands!
- This is an alpha phase — we want your feedback, as a user and as a tool creator — Please create an issue and join our Discord channel
The GraphQL CLI provides:
- Helpful commands to improve your daily workflows, from starting a project to maintaining it for the long run
- Rich ecosystem and compatibility with libraries, editors and IDEs based on a unified graphql-config
- 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.
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:
- Making it as easy as possible create and deploy GraphQL based applications
- Making it easier to maintain production-grade, scalable GraphQL applications
All of that while:
- Keeping the CLI updated with the latest solutions and practices
- Making it extensible and configurable without any solution bias — any approach and architecture could easily integrate and benefit from the CLI
- Keeping the industry leading, long term open source library maintenance standard that The Guild is known for
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 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:
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.
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:
- detect breaking or dangerous changes
- validate Operations and Fragments at build time
- analyze the usage of GraphQL Schema (unused types and fields)
- find duplicates and similar GraphQL Types
- serve faked GraphQL schema
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.
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.
graphql init command is trying to address three simple questions:
- Can we build an application template that can offer production-ready capabilities and yet is simple enough to work without extensive learning?
- Can we provide our data model as input to the GraphQL engine and benefit from autogenerated data access methods?
- Can we use the same techniques for an existing application and generate partial models?
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 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.