Use Graphcool templates to quickly pull in predefined functionality into your own Graphcool service.
We maintain a number of officially supported templates:
Notice that the outdated templates are not officially supported. Right now, most of the templates inside the outdated directory are not working when used with the
graphcool-framework add-template command!
Contributions are highly welcome 💚 if you'd like to add a new template, you can get inspiration from the help wanted label, or suggest your own template!
There are two ways how you can use a template in your service:
add-templatecommand from the CLI.
The process of adding a template to a Graphcool service involves several steps. You're basically merging your local service definition with the service definition of the template you want to use. In the end, you end up with only one
graphcool.yml as well as only one
Adding a template manually:
graphcool.ymlof your own service. Be sure to adjust any file references, e.g. source files that contain code for functions, if necessary.
types.graphqlof your own service.
add-template command in the Graphcool CLI basically automates the process of manually adding templates.
Official templates can be added by providing their relative path in this repository, e.g. for the
graphcool-framework add-template auth/email-password
To install your own templates, you can provide the path to a GitHub repository, too:
graphcool-framework add-template graphcool/templates/auth/email-password
When merging the template's
types.graphql files with the ones from your local service definition, the CLI will only add the contents from the template files into your local files as comments. So you need to explicitly uncomment the parts form the template files that you actually want to use in your service.
The process for using the CLI to add a template thus looks as follows:
add-template <path>CLI command and specify the
<path>which points to the template's directory in this repository.
A big thank you to all contributors and supporters of this repository 💚