Using StepZen Pre-built GraphQL API Templates

Predefined Specialized GraphQL APIs that help you get started quickly

StepZen's API templates are predefined GraphQL schemas with specific features that enables you to connect to StepZen and set up your GraphQL types and queries in minutes.

Where to Find the API Templates

You can find the API templates in two locations:

In our repository, each folder contains a directory of pre-built GraphQL APIs that you can import to get a live, connected StepZen endpoint on StepZen.

Let's get started!

1. Import a Pre-built GraphQL API to Start a Project from Scratch

Refer to the instructions in the quick start guide. In about five minutes, you'll have a GraphQL API endpoint up and running that you can query in your GraphQL browser.

2. Import a Pre-built GraphQL API to Extend an Existing Project

If you already have a project folder and GraphQL API (e.g., from having followed the quick start guide), you can extend it by importing other pre-built, specialized GraphQL API templates using the StepZen CLI.

Follow the steps below to import a pre-built GraphQL API to extend an existing project. This example shows how to import the Cloudinary and Airtable templates:

  1. Navigate to your project directory:
cd [myprojectfolder]
  1. Import one or more pre-built GraphQL APIs:
stepzen import schema,schema,schema...

Note: schema, schema, schema is a comma-separated list of pre-built API template names. See stepzen-schemas GitHub repository for a complete list of template names.

The StepZen CLI imports the schema(s) you specified, saves them in your project folder, and creates an index.graphql file at the root of your project structure to consolidate the individual schemas into one.

The following example shows the structure of myprojectfolder, after importing two schemas: Cloudinary and Airtable:

πŸ’βž” tree
    β”œβ”€β”€ index.graphql
    β”œβ”€β”€ stepzen.config.json
    β”œβ”€β”€ config.yaml
    └── cloudinary
        └── cloudinary.graphql
    └── airtable
        └── airtable.graphql

The resulting files are as follows:

  • cloudinary.graphql and airtable.graphql: The component schemas, which include the specifications for backend connectors. In this case, they exist inside their respective folders (cloudinary/cloudinary.graphql and airtable/airtable.graphql).
  • index.graphql: Located in the root folder, this file tells StepZen how to assemble the various type definition files into a complete GraphQL schema. It includes a comma-separated list of .graphql files in your project folder that are to be rolled up to build your GraphQL API endpoint.

The example below, shows how the index.graphql file looks like (where @sdl is a custom StepZen directive that specifies the relative paths for all of the .graphql files to assemble into your unified GraphQL schema):

    files: [
) {
  query: Query
  • config.yaml: Contains the keys and other credential information that StepZen needs to access Cloudinary and Airtable. To learn about this file, see Keys and Credentials Configuration Reference.
  • stepzen.config.json: Contains the endpoint you have chosen.
  1. Deploy and run your GraphQL endpoint:
stepzen start

When you run stepzen start, the StepZen CLI opens up a browser with the GraphiQL query editor, where you can query the new endpoint which has been uploaded and deployed to StepZen.

Behind the scenes, GraphiQL is connected to your endpoint at https://{ACCOUNT}{folder/name}/__graphl.

Authentication Using config.yaml

In the example above, you didn't need to provide authentication to access the APIs. But what authentication is required? If you had answered the following questions for stepzen import:

// Sample of questions to build your config.yaml
$ stepzen import cloudinary my-app
? What is the api_key for your cloudinary API? [input is hidden]
? What is the api_secret for your cloudinary API? [input is hidden]
? What is the cloud_name for your cloudinary API? [input is hidden]
Successfully imported 1 schemas from StepZen

then you will have a config.yaml file through which you can configure authentication. However, if you had pressed 'enter' to skip these questions, then you will need to build your own config.yaml file.

For Cloudinary, the file will look as follows:

- configuration:
    name: cloudinary_config
    api_key: { { api_key } }
    api_secret: { { api_secret } }
    cloud_name: { { cloud_name } }

If you get stuck, each folder for each schema repository has a readme that explains how to set it up. Or, feel free to contact us via our chatbox.

This site uses cookies: By using this website, you consent to our use of cookies in accordance with our Website Terms of Use and Cookie Policy.