GraphQL error handling to the max with Typescript, codegen and fp-ts

This page summarizes the projects mentioned and recommended in the original post on dev.to

SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
  • All the code examples can be found in this repository.

  • graphql-spec

    GraphQL is a query language and execution engine tied to any backend service.

  • :::note GraphQL Union is available for Types only, not for Inputs. However, the oneOf directive will bridge the gap in the future.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • ts-protoc-gen

    Protocol Buffers Compiler (protoc) plugin for TypeScript and gRPC-Web.

  • :::note When using remote APIs, we often have the possibility to generate the types automatically from a JSON schema for REST APIs, from protobuf files for gRPC-based APIs, from a database schema, etc. You might even be using an external API through an SDK that already provides you with all types. In such cases, the creation of specialized Error classes is not mandatory. However, it might still be a good idea to do so to provide application-specific errors rather than bubbling up 3rd-party low-level errors. For such cases, the upcoming Ecma TC39 proposal for Error Cause is useful as it allows to chain errors. Polyfills exist: Pony Cause or error-cause. :::

  • schemats

    Generate typescript interface definitions from SQL database schema

  • :::note When using remote APIs, we often have the possibility to generate the types automatically from a JSON schema for REST APIs, from protobuf files for gRPC-based APIs, from a database schema, etc. You might even be using an external API through an SDK that already provides you with all types. In such cases, the creation of specialized Error classes is not mandatory. However, it might still be a good idea to do so to provide application-specific errors rather than bubbling up 3rd-party low-level errors. For such cases, the upcoming Ecma TC39 proposal for Error Cause is useful as it allows to chain errors. Polyfills exist: Pony Cause or error-cause. :::

  • proposal-error-cause

    Discontinued TC39 proposal for accumulating errors

  • :::note When using remote APIs, we often have the possibility to generate the types automatically from a JSON schema for REST APIs, from protobuf files for gRPC-based APIs, from a database schema, etc. You might even be using an external API through an SDK that already provides you with all types. In such cases, the creation of specialized Error classes is not mandatory. However, it might still be a good idea to do so to provide application-specific errors rather than bubbling up 3rd-party low-level errors. For such cases, the upcoming Ecma TC39 proposal for Error Cause is useful as it allows to chain errors. Polyfills exist: Pony Cause or error-cause. :::

  • graphql-yoga

    🧘 Rewrite of a fully-featured GraphQL Server with focus on easy setup, performance & great developer experience. The core of Yoga implements WHATWG Fetch API and can run/deploy on any JS environment.

  • If you use Envelop or GraphQL Yoga (both developed by The Guild), you can already benefit from it today by using this Envelop plugin) :::

  • pony-cause

    Ponyfill and helpers for the standardized Error Causes

  • :::note When using remote APIs, we often have the possibility to generate the types automatically from a JSON schema for REST APIs, from protobuf files for gRPC-based APIs, from a database schema, etc. You might even be using an external API through an SDK that already provides you with all types. In such cases, the creation of specialized Error classes is not mandatory. However, it might still be a good idea to do so to provide application-specific errors rather than bubbling up 3rd-party low-level errors. For such cases, the upcoming Ecma TC39 proposal for Error Cause is useful as it allows to chain errors. Polyfills exist: Pony Cause or error-cause. :::

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • effect

    An ecosystem of tools to build robust applications in TypeScript.

  • In order to make our throwing and unsafe APIs into safe data fetching functions, we'll use data types and techniques from the Functional Programming paradigm. In particular, we'll use the fp-ts library (but you can choose the FP library of your choice, e.g. purify, effect, monio, and others).

  • Stack

    Tech Stack developed by The Guild (by the-guild-org)

  • GraphQL Code Generator is a tool developed by The Guild which generates type definitions which corresponds to the GraphQL schema. It has several plugins and we'll use 3 of those:

  • monio

    The most powerful IO monad implementation in JS, possibly in any language!

  • In order to make our throwing and unsafe APIs into safe data fetching functions, we'll use data types and techniques from the Functional Programming paradigm. In particular, we'll use the fp-ts library (but you can choose the FP library of your choice, e.g. purify, effect, monio, and others).

  • fp-ts

    Functional programming in TypeScript

  • In order to make our throwing and unsafe APIs into safe data fetching functions, we'll use data types and techniques from the Functional Programming paradigm. In particular, we'll use the fp-ts library (but you can choose the FP library of your choice, e.g. purify, effect, monio, and others).

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Introduction

    3 projects | dev.to | 1 Nov 2022
  • Generalizing a tuple of pipe functions

    2 projects | /r/typescript | 4 Jan 2022
  • [AskJS] Is anyone using Monads (or other advanced functional programming techniques) in production code? If so, what are you using them for?

    3 projects | /r/javascript | 29 Dec 2021
  • A hidden power tool for arrays in TS

    2 projects | dev.to | 25 Jan 2024
  • Deep Cloning Objects in JavaScript, the Modern Way

    8 projects | news.ycombinator.com | 21 Dec 2023