🔥 Tech Blips #22.6
In this technology newsletter: Monorepo, Nx, WebAssembly and Fly.io.
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:
- Techniques: Monorepo (Adopt)
- Tools: Nx (Trial)
- Language and Frameworks: WebAssembly (Assess)
- Platforms: Fly.io (Trial)
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:
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 👇
Tools (Trial)Nx Website
Nx is an intelligent, fast and extensible build system with first-class monorepo support and powerful integrations.
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:
- Run tasks
- Cache task results
- Explore the projects graph
- Distribute task execution
- Integration in editors, like VS Code
- Automate updating dependencies
- Enforcing project boundaries
Languages & Frameworks (Assess)WebAssembly Website
WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine.
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:
Running Example 👇
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.