Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. GraphQL
  3. graphql-scalars

graphql-scalars

MITTypeScriptv2.0.0

A library of custom GraphQL scalar types for creating precise, type-safe GraphQL schemas.

Visit WebsiteGitHubGitHub
1.9k stars141 forks0 contributors

What is graphql-scalars?

GraphQL Scalars is a library that provides a wide range of custom scalar types for GraphQL schemas. It solves the problem of GraphQL's limited built-in scalar types by offering specialized scalars for common data formats like emails, URLs, dates, and JSON, enabling more precise and type-safe API definitions.

Target Audience

GraphQL API developers and teams who need to enforce data validation and type safety at the schema level, particularly those building APIs with domain-specific data requirements.

Value Proposition

Developers choose GraphQL Scalars because it offers a battle-tested collection of scalars that integrate seamlessly with GraphQL, reducing boilerplate validation code and ensuring consistent data handling across the API.

Overview

A library of custom GraphQL Scalars for creating precise type-safe GraphQL schemas.

Use Cases

Best For

  • Enforcing email format validation in GraphQL mutations
  • Handling date and time fields with ISO 8601 compliance
  • Validating URL inputs in GraphQL queries
  • Passing arbitrary JSON objects through GraphQL APIs
  • Ensuring non-empty string values in schema definitions
  • Working with large integers beyond standard Number limits

Not Ideal For

  • APIs built with non-Node.js GraphQL servers (e.g., Python or Java), where integration requires custom wrappers or isn't natively supported
  • Projects requiring highly domain-specific scalar types (e.g., geographic coordinates or currency), as the library focuses on common formats and may not cover niche needs
  • Teams aiming for minimal dependencies or lightweight setups, since adding this library introduces extra package overhead for validation that could be hand-coded

Pros & Cons

Pros

Email and URL Validation

Provides built-in Email and URL scalars that automatically validate format, reducing the need for manual validation code in resolvers or clients.

ISO 8601 DateTime Support

The DateTime scalar ensures precise date and time handling with ISO 8601 compliance, as highlighted in the key features for consistent API data.

JSON Data Flexibility

Includes a JSON scalar for passing arbitrary JSON objects through GraphQL, enabling complex data structures without bloating the schema with custom types.

Non-Empty String Enforcement

Offers a NonEmptyString scalar to guarantee strings are not empty at the schema level, adding validation without additional middleware.

Cons

External Documentation Dependency

Full documentation is hosted separately on graphql-scalars.dev, which can be less accessible than inline docs and might lag behind library updates.

Setup and Configuration Overhead

Integrating multiple scalars requires manual addition to the GraphQL schema, which can be verbose and error-prone for large or complex schemas.

Limited Extensibility for New Types

While comprehensive, the library doesn't cover all scalar needs, and creating custom scalars isn't as streamlined as using the provided ones, requiring extra boilerplate.

Frequently Asked Questions

Quick Stats

Stars1,931
Forks141
Contributors0
Open Issues40
Last commit19 days ago
CreatedSince 2017

Tags

#graphql#type-safety#schema#schema-validation#graphql-js#api-development#custom-types#data-validation

Links & Resources

Website

Included in

GraphQL15.0k
Auto-fetched 10 hours ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub