Skip to main content

Comparison with other clients

This page compares typed-graphql-builder with Zeus and tql, as those were the two libraries that served as the primary inspiration.

typed-grapql-builder owes much of its API design to tql. Although our initial design sketches predate it, tql is still the principal inspiration for typed-graphql-builder's API, especially variables, aliases and selections, with only a few differences:

  1. scalar fields can be selected without method calls i.e. [t.id, t.name] instead of [t.id(), t.name()]
  2. the union selection method is called $on instead of on to more easily avoid conflict with existing field names
  3. fragments are supported via the fragment function

In terms of capabilities, there are two notable differences:

  1. typed-graphql-builder can infer a variable placed anywhere in an input type.
  2. typed-graphql-builder supports custom mapping for scalars

The generated code is where most of the differences come from. Here, we took inspiration from the way graphql-zeus provides a compact map of all input types. In this way, we reduce the generated code size to ~ 25% of what tql generates.

The estimate is based on the Hasura generated schema of a large database included in the examples (x.graphql). Below is the size of the generated client for a very large Hasura schema:

schematqltyped-graphql-builder
x.graphql3.43 MB0.71 MB

note: generated with tql v1.0.0-rc.10 and typed-graphql-builder v1.3.1