How StepZen Works

A configuration-driven approach to creating a GraphQL API

StepZen is a configuration-based platform for building GraphQL APIs that connect directly to any data source (SQL, NoSQL, REST) and even other GraphQL APIs. It also enables you to handle more complicated use cases such as authentication and deployment. With little code, you can combine different data sources in one fully-performant API that you can use in your applications from day one.

With StepZen, you define your schema using SDL (GraphQL's schema definition language), and enhance it with custom GraphQL directives that supply StepZen with the configuration details. Custom directives enable capabilities like:

  • Connecting to a database (@dbquery).
  • Connecting to a REST API (@rest).
  • Linking types together (@materializer).
  • Executing queries in sequence (@sequence).

StepZen's Declarative and Config-driven Approach

In a typical GraphQL server implementation, you need to define Schemas (in SDL) and Resolvers (in whatever language you choose) for your API backend.

With StepZen, there are no resolvers to write. Instead, you define Types, Queries, and Mutations in your schema (SDL), annotated with custom GraphQL directives.

When the SDL code is uploaded, StepZen validates the schema and generates the API backend needed to support your GraphQL API, including the following:

  • Resolvers
  • Mutations
  • Authentication logic

In the following example, we've created a Customer type with a customerById query. The customerById query contains a StepZen @rest directive configured with a REST endpoint.

type Customer {
    id: ID!
    name: String!
    email: String!
}
type Query {
    customerById (id: ID!): Customer
       @rest (endpoint: "https://samples.apis.stepzen.com/simplecustomer/$id")
}

StepZen takes this file and creates the Customer type while generating the resolver for the customerById query, that is already associated with the provided endpoint for retrieving data. The data is then mapped to the type where the id, name, and email values are returned by the root JSON object in the REST result.

Note: You can customize how the values are mapped, but this example uses the simplest possible configuration.

Developers only need to upload the necessary schema files to have a complete GraphQL API. There is no need to write resolvers or maintain servers.

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.