z The Flat Field Z
[ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ]

Dataloader

cache performance typescript graphql

Request scoped caching is an incredibly common practice in back-end services. Dataloader is a way to implement request scoped caching, but it has a trick up its sleeve that makes it particularly useful for GraphQL.

Avro

stack architecture typescript

Binary encoding formats offer many advantages such as compact storage, fast encoding/decoding, and well thought out ways to evolve your schema. But they often require a great deal of developer buy in with DSLs and distinct compilation steps. Avro has the same advantages as other binary encoding formats but has a superior developer experience.

Dependency Injection

testing typescript

Dependency injection is a pattern where a chunk of code doesn't directly reference its dependencies. Instead its caller provides the dependencies. This is made possible by the caller and the callee agreeing on contracts for the dependencies.

Doing this allows implementation of the dependencies to be easily swapped out, which is useful for writing unit tests.

Traces

observability traces typescript

Understanding why a distributed system is slow is a hard problem. A single request might trigger dozens of requests behind the scenes across a large number of discrete components.

Traces are an extraordinarily useful tool for this problem, and now with OpenTelemetry they are easy to implement in a vendor agnostic way.

Structured Logging

observability typescript

Back-end services are almost always configured to write out logs, and the people who operate those services will need to look at them to debug issues.

By writing those logs out in a machine readable format you can get far more value out of those logs.

Schema Validators

stack validation typescript

Most back end services will accept input by way of JSON. After verifying that the JSON is well formed there is a large amount of validation that will need to performed such as:

A class of libraries called schema validators solve this problem in an elegant and declarative way.

Query Builders

stack sql typescript

Most back-end services will end up making calls to a relational database. The two most popular ways to do this are with raw SQL, or using a an Object Relational Mapping (ORM) library. But there is a third level of abstraction out there called a query builder. I believe that of the three approaches the query builder one is the best.

Vite SPA with ASP.NET Core Backend for Frontend

csharp docker typescript vite aspnetcore

Single-page-applications (SPAs) have a lot of desirable characteristics such as a high level of interactivity and ease of deployment. Unfortunately the security story is not as strong. Without a backend they have to store sensitive credentials they need to access APIs on the client side. These difficulties are further compounded by increasingly strict browser cookie defaults that make implementing more complicated auth flows like OpenID Connect very difficult.