Skip to content

Instantly share code, notes, and snippets.

@lucasreta
lucasreta / graphql-clients-benchmark.md
Created May 26, 2021 04:57 — forked from oddlyfunctional/graphql-clients-benchmark.md
Comparison between GraphQL clients

Client-side GraphQL

graphql_ppx

Let's first analyze how to write the queries. I experimented the graphql_ppx with a few different features (nullable and non-nullable variables, fragments, convert response into record automatically). The type safety is very neat, both the input variables and the response have specific types (no Js.Json.t!), and the queries/mutations are validated against the schema! This makes it really easy to write queries, although I worry about integrating new versions of the schema since the repos are separated (we should probably re-fetch the schema as part of the CI).

As for the drawbacks, there are not many:

  • The ppx really messes up my language server sometimes.
  • I haven't tried a lot but I couldn't find easily a way to use refmt to format the queries.
  • I couldn't find anything about custom directives, the lack of which would prevents us from using some features from the GraphQL clients (for example, managing local state using Apollo's @client directive).
  • I haven't
@lucasreta
lucasreta / jwtRS256.sh
Created December 29, 2020 21:33 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub