Leverage Hasura Events and GraphQL to sync a Postgres database into denormalized ElasticSearch documents.

Permalink: https://gunargessner.com/postgres-hasura-elasticsearch

Why sync Postgres to ElasticSearch?

Syncing Postgres to ElasticSearch

If searching is a core feature of our app, we will want to use ElasticSearch. Although Postgres does have a Full Text Search feature, it doesn’t scale well—especially when the requirements include searching across multiple tables.

ElasticSearch is ubiquitous when we’re talking about search engines. It is speculated that for a number of years Lucene (its underlying library) powered all of the Google search engine. ElasticSearch generates multiple indexes for each document inserted and that is how it manages to be so fast

So, how do we sync Postgres data to ElasticSearch ?

At the bottom of this…

Which one is the best unified API gateway?

Permalink: https://gunargessner.com/graphql-federation-vs-stitching

Apollo Federation and Hasura Schema Stitching both can serve as our company’s centralized API gateway, but they have very different philosophical stances and provide different features.

Federation assumes a company’s schema should be a distributed responsibility

We’ll want to use Apollo Federation iff we believe services should be able to extend each other’s schemas.

Unlike other distributed GraphQL architectures (such as schema stitching), Apollo Federation uses a declarative programming model that makes it easy for each implementing service to implement only the part of your data graph that it should be responsible for. This way, your organization can represent an enterprise-scale data graph as a collection of separately…


Permalink: https://gunargessner.com/why-we-chose-google-automl

CONTEXT: Invisible is going Machine Learning, and our first goal is to use ML to aid us in routing client delegations. When a client sends us an email, we’ll use the emails’ content to infer whether the task should be routed to the “Calendar” team, the “Lead Sourcing” team, or any other of our capabilities.

The Pareto principle states that, for many events, roughly 80% of the effects come from 20% of the causes.

We’re not off to become Machine Learning experts (yet), so we will try and make the most out of the existing frameworks and services…

How to generate Bitcoin addresses from an HD Wallets’ XPUB key.

Bitcoin wallets are nothing but private/public key pairs. The private key is your “password”, while the public key is your “address” for receiving currency.

It is advised that we use different addresses for each transaction, in order to increase our privacy and security. Normally one would simply generate multiple keys, and send each public key to a different person. However, the number of keys we have to carry around would keep increasing to the point that it just wouldn’t be practical.

That’s why HD Wallets (Hierarchical Deterministic Wallets) were invented. These wallets allow us to generate many addresses from a…

Month: June

I’ve recently implemented GraphQL at Invisible. These are some of the things that we’ve realized together. Getting buy-in from stakeholders is perhaps as important as writing the code. I hope this post helps you with that.

PS: I’ve prioritized clarity over correctness.

GraphQL: Cost of investment.

  • Requires training. It’s one more thing for Engineers to learn. Makes it harder to hire people who can hit the ground running.
  • Requires rework (sometimes). The existing code needs to be converted. Although you can replace endpoints gradually, rewriting them at once gets you a higher bang-for-the-buck.
  • Requires attention to performance.

A Note on Uncontrolled Forms (you can skip this).

I don’t know about you, but when possible I prefer to use uncontrolled components and refs—as demonstrated below.

Resetting Uncontrolled Forms.

The key prop is commonly used to efficiently render React Components from arrays, but you can use it for any component.

We can “abuse” this property to force React to rebuild the DOM, thusly resetting any values that the user might have entered into the fields.

Here’s a quick example:

Live version (CodeSandBox)

Thank you.

Photo by rawpixel on Unsplash

Hi! This is a part of my series on mental models. Click here for other parts.


What Is a Record Locator.

A record locator can be used to provide a human-readable representation of a database primary key, providing users with a short, easy-to-read and pronounceable string, like those alpha-numeric confirmation codes that flight companies usually provide.

March 2019

Checking field presence and absence.

Let’s say you want a field to either contain something of type T, or not contain the field at all—in effect, disallowing { field: undefined }—much like our friend Greg here.

It seems resolving this problem would require TypeScript to implement Exact Object Types, but we’re not going to just sit around and wait, are we?

So we can’t define this exact mental model in TypeScript, but let’s focus on what we can do. …

Wednesday, 06 March 2019

Photo by Andrew Wulf on Unsplash

Property-based Testing in a nutshell.

Hi! Welcome to part one of my series on mental models. Click here for other parts.

Let’s say we have ourselves a sorting function called mySort ,

Standardized testing would ask you to come up with some values to be tested,

whereas Property-based Testing asks you to declare the schema of the data,

Property-based Testing example (pseudo-code).

and the testing framework takes care of generating the test-data for you.

The actual code is quite similar. The only difference being that in a standardized test you provide values, whereas for property-based tests you provide arbitraries* (i.e. …

I’ve recently tipped my toe on a few topics regarding our conceptual models around the systems we build and have decided to share with you what I’ve learned. I’m going to try and define each one of these tools using my own words. If I can get you to understand the gist of each one, perhaps you’ll be able to identify uses for them in your own projects.

My definitions will by no means be exhaustive as I’m prioritizing simplicity over correctness. Bottom-line: read at your own peril.

This will be a series of six parts.

Start at Part 1: Property-based Testing.

Serro Toco, Chile.

Gunar Gessner

Software that gets jobs done — gunargessner.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store