Posted on

Kickstart your full stack GraphQL application with GRelDAL starter – II

In the previous post of this series, we tried out the GRelDAL starter and bootstrapped a simple application.

In this (and the next) post, we dig deeper into what is happening in the application, and then in the last two posts of the series, we will extend this application to build something more closely resembling a real world app.

Posted on

Using theme specific keybindings in VSCode to improve productivity

I have been using VSCode as my primary editor for a couple of months. However it has been a recurring pain point for me that we have to switch back and forth between the arrow keys and primary rows when editing code. This post outlines a somewhat non-conventional approach for this by abusing the when clause of vscode keybinding configuration.

Continue reading Using theme specific keybindings in VSCode to improve productivity

Posted on

Exposing the type of a typescript class while hiding the implementation

When we define a typescript class, we are actually defining two things, a constructor function, and a type. The instances constructed using the constructor defined by a class will have the type of the class.

One might wonder, if it is possible, say from a library, to expose only the type of the class and not the actual type constructor. The goal here may be to prevent direct instantiation of the class, or prevent consumers from monkeying around with the prototype chain of the constructor.

Continue reading Exposing the type of a typescript class while hiding the implementation

Posted on

Using an SVG grid background for aligning elements in web page

One of the recurring annoyances when designing websites is ensuring alignment of elements on a web page.

Most design applications have the provision of an overlay grid. With very little effort we can add a simple grid to any web page and use it to ensure alignment of elements.

Continue reading Using an SVG grid background for aligning elements in web page

Posted on

Simplifying generics-heavy typescript code using Container Interfaces, Extractor Types and Companion Namespaces

Writing generics-heavy code code in Typescript can sometimes be arduous, especially because typescript doesn’t facilitate higher kinded types at language level.

So, a function that accepts multiple arguments of generic types often has to accept type parameters of all these generic types in order to retain type safety:

This can get cumbersome fast, especially when the parameterized types have constraints on the type parameters because now these constraints also have to be replicated:

Continue reading Simplifying generics-heavy typescript code using Container Interfaces, Extractor Types and Companion Namespaces

Posted on

Integrating Google diff-match-patch with AutoMerge.Text

This post outlines the use of Google’s diff-match-patch library to generate patches that can be translated to operations against an AutoMerge.Text CRDT for situations when deriving the operations directly from user interactions is cumbersome.
Continue reading Integrating Google diff-match-patch with AutoMerge.Text

Posted on

Uploading files to MongoDB GridFS via Apollo powered GraphQL API

GraphQL multi-part request spec outlines a specification for multipart form requests in GraphQL. Jayden Seric, the author of the spec, has also authored two libraries apollo-upload-client and apollo-upload-server which makes it effortless to integrate file uploads in Apollo Server.

GridFS is a simple file system abstraction on top of MongoDB. This facilitates storage of large files (beyond BSON document size limit) in mongo database.

This post outlines the minimal integration required to save the files uploaded through the GraphQL API to GridFS.

Continue reading Uploading files to MongoDB GridFS via Apollo powered GraphQL API