Use Graphcool templates to quickly pull in predefined functionality into your own Graphcool service.
We maintain a number of officially supported templates:
- auth: Templates for different authentication mechanisms, such as email-password, firebase or facebook.
- messaging: Templates to quickly integrate with different messaging services, such as mailgun (emails), pusher (push notifications) or twilio (SMS).
Notice that the community templates are not officially supported. Right now, most of the templates inside the community directory are not working when used with the graphcool add-template
command!
They do however already contain the code that's necessary to use the provided functionality into your service. You might need to do a bit more manual work to actually get them up-and-running.
There are two ways how you can use a template in your service:
- Manually download and copy the code from a template directory in this repository.
- Use the
add-template
command 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 types.graphql
.
Adding a template manually:
- Download the folder that contains the service definition of the template you want to use.
- Copy that folder into the root directory of your Graphcool service.
- Copy over the contents from the template's
graphcool.yml
into thegraphcool.yml
of your own service. Be sure to adjust any file references, e.g. source files that contain code for functions, if necessary. - Copy over the contents from the template's
types.graphql
into thetypes.graphql
of your own service. - Deploy your changes with
graphcool deploy
.
The add-template
command in the Graphcool CLI basically automates the process of manually adding templates.
The only option that can be provided to this command is the path to the template on GitHub, e.g. for the email-password
-template:
graphcool add-template graphcool/templates/authentication/email-password
When merging the template's graphcool.yml
and 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:
- Use the
add-template <path>
CLI command and specify the<path>
which points to the template's directory in this repository. - Uncomment the lines in
graphcool.yml
andtypes.graphql
. - Deploy your changes with
graphcool deploy
.
A big thank you to all contributors and supporters of this repository 💚
![marktani](https://github.com/marktani.png?size=64&raw=true)
![yusinto](https://github.com/yusinto.png?size=64&raw=true)
![kuldarkalvik](https://github.com/kuldarkalvik.png?size=64&raw=true)
![heymartinadams](https://github.com/heymartinadams.png?size=64&raw=true)
![pbassut](https://github.com/pbassut.png?size=64&raw=true)
![kbrandwijk](https://github.com/kbrandwijk.png?size=64&raw=true)
![dkh215](https://github.com/dkh215.png?size=64&raw=true)
![sorenbs](https://github.com/sorenbs.png?size=64&raw=true)
![petrvlcek](https://github.com/petrvlcek.png?size=64&raw=true)
![mwickett](https://github.com/mwickett.png?size=64&raw=true)
![katopz](https://github.com/katopz.png?size=64&raw=true)
![randomer](https://github.com/randomer.png?size=64&raw=true)
![picosam](https://github.com/picosam.png?size=64&raw=true)
![antho1404](https://github.com/antho1404.png?size=64&raw=true)
![BoraKilicoglu](https://github.com/BoraKilicoglu.png?size=64&raw=true)
![peterpme](https://github.com/peterpme.png?size=64&raw=true)
![Gregor1971](https://github.com/Gregor1971.png?size=64&raw=true)
![jhalborg](https://github.com/jhalborg.png?size=64&raw=true)
![jhalborg](https://github.com/felipesabino.png?size=64&raw=true)
Say hello in our Slack or visit the Graphcool Forum if you run into issues or have questions. We love talking to you!