How StepZen Works

A configuration-driven approach to creating a GraphQL API endpoint

StepZen is a configuration-based system for building serverless GraphQL APIs that connect directly to any data source (SQL, NoSQL & REST) and even other GraphQL APIs. It also allows you to handle more complicated use cases such as authentication and deployment. Using little code, you'll 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), enhance it with custom GraphQL directives that supply StepZen with the configuration details. Cuatom directives enable capabilities like connecting to a database (@dbquery) or a REST API (@rest), linking types together (@materializer), or executing queries in sequence (@sequence).

When the schema (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 a typical GraphQL server implementation, you need to define the following for your API backend:

  • Schema in SDL
  • Resolvers (in whatever language you choose)

With StepZen, you define the following in SDL, annotated with custom GraphQL directives:

  • Types
  • Queries
  • Mutations

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, which is already wired to 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 for this example we're using the simplest possible configuration.

The result is that you, as a developer, do not need to do anything except 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.