Demergent Labs: TypeScript, GraphQL, and Python on the Internet Computer

Demergent Labs is making it extremely simple for developers to write decentralized applications that run on the Internet Computer.

Jordan Last
The Internet Computer Review
5 min readApr 19, 2022

--

TL;DR: Write canisters in TypeScript with Azle, and keep tabs on Demergent Labs for GraphQL, Python, and more for the Internet Computer.

Hi, I would like to introduce you to a new company I’ve created called Demergent Labs. Our goal is to accelerate the adoption of Web3 and the Internet Computer, a decentralized logical computer built from an open protocol that will be owned and operated by independent entities.

Demergent Labs is removing barriers to entry, making it extremely simple for developers to come over to the Internet Computer and write decentralized applications that take advantage of its unique characteristics and benefits over centralized cloud providers and other layer-1 protocols.

Our thesis is simple: By focusing on the technologies that are really working well in the Web2 world, we believe we can accelerate the adoption of Web3. We can also greatly improve some of the technologies that made Web2 great (decentralized npm registry anyone?).

We’re starting off with three flagship projects: Azle (TypeScript CDK), Sudograph (GraphQL Database), and Kybra (Python CDK).

TypeScript development on the IC

The fundamental application unit of the Internet Computer is called a canister smart contract. Canisters contain the code and state of your application, and users interact with them through simple RPC calls over the internet. Basically, canisters expose functions that can be called through network requests like HTTP.

Developers can use canisters to create and deploy applications on the Internet Computer in any language that runs on WebAssembly. For the past couple of years, most developers have written their canisters in Motoko, a new programming language created by the DFINITY Foundation, or Rust. Many developers are unfamiliar with these languages, and it can be a huge point of friction for them to learn a new language, with all of its nuance, idioms, libraries, package managers, etc.

Enter Azle, a canister development kit that allows developers to write their canisters in TypeScript (and technically JavaScript as well).

This is a big deal. TypeScript and JavaScript are some of the most popular programming languages ever to exist. They have years’ worth (or in JavaScript’s case, decades’ worth) of community, libraries, documentation, YouTube videos, blog posts, podcasts, and expertise. There are millions of TypeScript and JavaScript developers who already love using TypeScript and JavaScript. Why take that away from them?

The DFINITY Foundation has put a lot of effort into making Motoko and Rust first-class languages on the IC. They’ve done a great job, and the burgeoning community has been very productive. But there are a few challenges with using Motoko and Rust.

Rust is a very difficult language to learn. It’s a systems or low-level language. It gives you extreme control over many aspects of the environment it runs in, and thus is more unwieldy. It’s a beautiful language that I love to use, but many developers, especially newcomers to programming in general, will have an extremely difficult time learning Rust. There’s a reason that high-level languages exist.

Motoko is a high-level language. It abstracts away many of the difficulties of low-level languages like Rust. That’s why developers love high-level languages, they are simply easier to use. But Motoko is a very new language. It lacks a large community, many libraries, mature documentation, YouTube videos, blog posts, podcasts, and generally years of expertise. Put simply, it is a new language for which these resources are yet to arise.

Azle offers an alternative to Rust and Motoko. Here’s the source code for a simple canister written in TypeScript with Azle. It’s just a read-only query function that returns “Hello World!”:

Deploying that to the IC with a simple dfx deploy --network ic will instantly allow anyone in the world to call this helloWorld function and see that beautiful phrase.

Here’s the source code for a simple canister that is a key-value store:

That’s a database folks. One dfx deploy --network ic and you have exposed a simple database to the world.

And there you have it, just a taste of what it’s like to write canisters with TypeScript and JavaScript on the Internet Computer. Let’s end our discussion of Azle with some wise words:

In addition to Azle, Demergent Labs is working to bring the IC an unbounded GraphQL database (Sudograph) and Python (Kybra). Azle and Sudograph are both in beta, and 1.0 is expected by the end of 2022 (and possibly much sooner). Expect a direct integration of Sudograph into Azle. The idea is to take the TypeScript types that you already define for your app, and generate an entire database complete with complex queries, mutations, a GraphQL interface, etc. It may look something like this:

Not only will Azle generate Candid from the types above, it will also generate GraphQL queries and mutations along with their resolvers, allowing you to instantly persist and retrieve data in complex ways without having to write that code yourself.

Kybra is in an earlier stage of development, but hopefully won’t lag too far behind Azle and Sudograph. Each of these projects will tear down barriers to adoption for various Web2 communities and make it extremely simple to develop decentralized applications on the IC.

There’s a lot of work to do in Web3 and for the Internet Computer. The dream of a massive Web3 ecosystem running on an infinitely scalable and unhackable decentralized computer is beautiful. We aren’t there yet, but we’re working hard to get there. Demergent Labs is also experimenting with new intellectual property, governance, and funding mechanisms that could solve some of the sustainability issues that have plagued open-source software since its inception.

Please, in your own way and with your skills and talents, help us build this amazing new future.

Yours truly,

@lastmjs

____

Start building at smartcontracts.org and join the developer community at forum.dfinity.org.

--

--