πŸ”₯ Tech Blips #22.6

In this technology newsletter: Monorepo, Nx, WebAssembly and Fly.io.

πŸ”₯ Tech Blips #22.6
Landing Page slogan of Nx
Tech Blips is a technology newsletter for CTOs, tech leads, software architects and software engineers - in short, for all technology enthusiasts!

Every month I try to summarise some techniques, tools, languages and frameworks or platforms on the cloud and web horizon that are worth taking a look at.

TL;DR in this technology newsletter:

Monorepo

Techniques (Adopt)

Monorepo explained

For a long time, the de facto standard for structuring source code in Git repositories was the polyrepo approach.

Polyrepo means that there's a separate repository for each team, application, or project. Typically, each repository has a single build artefact and a simple build pipeline.

In contrast to polyrepo, there's the monorepo technique: a monorepo is a single repository for an entire organisation that contains several different projects with clearly defined relationships.

The following figure shows the difference between these two techniques when dealing with Git:

Difference between polyrepos and a monorepo

With the monorepo approach across all projects you're able to:

πŸ’‘ Β Local and distributed computation caching.

The ability to store and reuse files and process output from build and deployment tasks.

Whether on the same machine or remotely across different environments, you'll never build or test the same thing twice.

πŸ’‘ Workspace Analysis

You've a single source of truth for all projects in one repository. So you can analyse the entire dependency graph easily.

πŸ’‘ Easy code sharing

Each project can share its code with other projects without any additional configuration overhead.

πŸ’‘ Local and distributed task orchestration

You can run different time-consuming tasks in parallel. So it's also possible to delegate some tasks to different distributed build agents that can be easily orchestrated.

πŸ’‘ Identify affected projects and packages

When you change a common source code, you can directly see which projects and packages are affected.

πŸ’‘ Consistent tooling

A monorepo means that you've the same build tooling and build logic for all projects.

If you want to learn more about monorepo, I recommend this page πŸ‘‡

Monorepo Explained
Everything you need to know about monorepos, and the tools to build them.

Nx

Tools (Trial)

Nx Website

Nx is an intelligent, fast and extensible build system with first-class monorepo support and powerful integrations.

Nx landing page intro
Nx landing page intro

Nx is a build system with a powerful core driven by metadata and extensible by plugins.

Nx works with some concepts like caching or distributed task execution to run your monorepo efficiently and effectively.

The Nx core brings the following features:

Youtube Video: How Nx and Monorepos just made my life 10x better

WebAssembly

Languages & Frameworks (Assess)

WebAssembly Website

WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine.

WebAssembly is a new type of code that can be executed in modern web browsers. It's a low-level language with a compact binary format that runs with near-native performance and provides a compilation target for languages such as C/C++, C#, Go or Rust that can run on the Web. It's also designed to run alongside JavaScript so that the two languages can work together.

With the WebAssembly JavaScript APIs, you can load WebAssembly modules into a JavaScript application and exchange functionality between the two. This allows you to leverage the power and strength of WebAssembly and the expressiveness and flexibility of JavaScript in the same applications, even if you don't know how to write WebAssembly code.

From a modern language to Wasm Code

An interesting WebAssembly example comes from Snaplet and Supabase. They've developed a PostgreSQL server that runs inside the browser.
Postgres WASM from Snaplet and Supabase Blog Post:

Postgres WASM by Snaplet and Supabase
We’re open sourcing postgres-wasm, a PostgresQL server that runs inside a browser, with our friends at Snaplet.
Blog Post Postgres WASM

Running Example πŸ‘‡

Supabase WASM: PostgreSQL in the Browser
With Wasm: PostgreSQL Server that runs inside a browser

Fly.io

Platforms (Trial)

Fly.io Website

Heroku has canceled his free plan! Fortunately Fly.io comes to the rescue!

Fly.io, like Heroku, is a global application distribution platform. Fly.io runs its code in Firecracker microVMs around the world.

With Fly.io, you can use Docker to build the container image with your app and its environment. You can also point it to a prebuilt image.

In many cases, you won't need to touch Docker at all. Fly.io can scan your source code and detect which pre-existing buildpack matches the configuration you need, and our remote builder will build your app container image as you deploy.

How to deploy a NestJS Docker container to Fly.io