How StepZen Works

A configuration-driven approach to creating a GraphQL API endpoint

StepZen offers a configuration-based system for building a GraphQL API backend that connects directly to databases, APIs and other services for data. StepZen allows the developer to define their schema using SDL, GraphQL's schema definition language, enhanced with custom GraphQL directives that supply StepZen with the configuration details it needs to do things like connect to a database or link two types together.

Once the SDL code is uploaded, StepZen validates the schema and generates the API backend, including the resolvers, mutations, authentication logic needed to support your GraphQL API. Let's look at a simple example.

In a typical GraphQL server implementation, you'd need to define the schema in SDL and then the resolvers in whatever language you choose for your API backend. However, in StepZen, you define the types, queries and mutations in SDL that is annotated with custom GraphQL directives. 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 wired to the provided endpoint for retrieving data. That data is then mapped to the type wherein the id, name and email values are returned by the root JSON object in the REST result (note that you can customize how the values are mapped, but for this example we're using the simplest possible configuration).

The result is that you, the developer, do not need to do anything except upload the necessary schema files to have a complete GraphQL API. No writing resolvers. No maintaining 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.