Top 5 GraphQL Scalars

Abhi Aiyer
4 min readJun 30, 2018

I’ve recently been taking advantage of building custom scalars to simplify presentational logic across all my API clients. Before I share with you my favorite scalars, let’s talk about what scalars are and what custom scalars can allow you to do.

What are Scalars?

Scalars are another type and represent leaf values of the GraphQL type system. A good way to look at this is through this graph:

The leaves of this graph are the scalars.

Even if you didn’t know what scalars were, there’s a good chance you have used them in GraphQL development.

String, Int, Boolean, Float are all built-in scalars that you can do a lot with out of the box!

But what really interested me about scalars was this excerpt from the GraphQL specification:

GraphQL provides a number of built‐in scalars, but type systems can add additional scalars with semantic meaning.

The semantic meaning leaves it open to the interpretation of the engineers implementing their system!

Why add custom scalars?

Well the goal of leveraging this customization is to unify how data is transferred between your clients and server.

--

--