Pear Runtime: Zero-Infrastructure, P2P High-Scale Applications

Rate this content
Bookmark
Pear Runtime is an open-source, peer-to-peer runtime that runs entirely on user devices, ensuring no data is stored in the cloud. It can be installed with the command 'MPX Pair' and supports running native modules. The platform is versatile, allowing for the creation of terminal, desktop, and mobile applications, including the Keet messaging app, which is available on the App Store and Google Play Store and collects no data. Pear Runtime uses a Distributed Hash Table (DHT) for peer discovery and a hole-punching algorithm to bypass NAT restrictions. Developers can find documentation and resources at docs.pairs.com. The platform emphasizes data security and simplicity in architecture, making it ideal for building high-scale applications without relying on cloud services. Pear Runtime leverages JavaScript runtime called Bear and includes all necessary tools for creating applications. It offers a true peer-to-peer environment, different from blockchain technology, as it does not involve a central repository or cloud. The 'pair run' command in the CLI is used to run applications from local folders or keys from the DHT.

From Author:

Introducing a combined Peer-to-Peer Runtime, Development & Deployment tool named Pear. Build, share & extend unstoppable, zero-infrastructure P2P applications. Welcome to the Internet of Peers. See docs.pears.com.

This talk has been presented at JSNation 2024, check out the latest edition of this JavaScript Conference.

FAQ

Pair Runtime is a peer-to-peer runtime platform that allows for the creation and deployment of zero infrastructure, high-scale applications. It operates entirely on user devices without relying on cloud services.

Unlike blockchain, which uses a global state and federated system, Pair Runtime is fully peer-to-peer, with data living only on user devices. There is no central repository or cloud involved.

Yes, Pair Runtime is fully open source. You can review the code to verify its peer-to-peer architecture and ensure that no data is being harvested.

If you have Node installed, you can bootstrap Pair Runtime immediately with the command 'MPX Pair'. This installs a small Node script that bootstraps Pair from the peers.

The 'pair run' command in the Pair CLI is used to run Pair applications. You can run both local folders and keys from the Distributed Hash Table (DHT) using this command.

You can build terminal applications, desktop applications, and mobile applications using Pair Runtime. It supports a variety of development and deployment commands to facilitate this.

Keet is a messaging application built on Pair Runtime. It runs on both desktop and mobile and has been verified by Apple and Google to collect no data.

The Distributed Hash Table (DHT) in Pair Runtime allows peers to discover each other and connect directly. It is used for seeding P2P state and running applications from seeds.

Yes, Pair Runtime can run native modules. It supports writing and seeding C code that can be run by other peers.

Documentation and resources for Pair Runtime can be found at docs.pairs.com. The site includes tools, helpers, building blocks, how-tos, and videos to help you get started.

David Mark Clements
David Mark Clements
8 min
13 Jun, 2024

Comments

Sign in or register to post your comment.

Video Transcription

1. Introduction to Pair Runtime

Short description:

Pair Runtime is a fully peer-to-peer runtime that operates on user devices, with no data stored in the cloud. It is open source and can be installed using MPX Pair. The CLI allows running applications built on Pair, such as the Keet messaging app, which is available on the App Store and Google Play Store and collects no data.

My name is David, and I'm the creator, along with my team, of Pair Runtime. This is about zero infrastructure, high-scale applications, but it's also an appeal to humanity in a way.

Let me ask this. What is the net total output of, like systemically speaking, of all of our human activities? Where is it taking us?

Pair is a peer-to-peer runtime. By peer-to-peer, I mean fully peer-to-peer. Local state, not like blockchain which is global state and federated, but literally peer-to-peer. The data lives on user devices and only on user devices. No cloud. Nothing. Just the peers. To show that it is what we say it is, Pair is open source. It's been open source since February. You can look through all of the code and verify that it is, in fact, peer-to-peer, and that no data is being harvested because it cannot actually be. It can't be.

If you have Node installed, you can bootstrap Pair immediately with MPX Pair. This installs a small Node script which bootstraps Pair from the peers. Pair is not Node. It's its own thing. You can use MPX Pair to install Pair from the peers at any time you like. As I say, it's fully open source, so feel free to look through before you do so.

It's a runtime. It installs a CLI. The CLI has a run command, pair run, the Pair protocol, and then a key. That key is a topic on a distributed hash table, a global distributed hash table that allows peers to discover each other and connect directly.

If you have pair installed, you can run pair run pair keet. This will open the Keet application. This is an application that has been built on Pair for messaging. It runs on desktop and mobile. You can scan this QR code to get it on mobile on the Play Store and the App Store. When you look down on the App Store and Play Store, you will see that both Apple and Google have verified that the application collects no data.

2. Pair Development and Deployment

Short description:

Pair is a development and deployment tool that enables creating and running Pair applications on user devices. It is a JavaScript runtime called Bear, which supports P2P primitives and allows running native modules. Pair is a platform.

Pair is a development tool. It's a CLI tool that you can use to actually create Pair applications. These are the development commands. Pair init to create a Pair project, Pair stage which copies your file system state into a P2P structure called HyperCore, and Pair run, which you can use to run both local folders and keys from the DHT, application keys. Again, there is no infrastructure involved here. This is just peers talking to each other. The applications load from peers.

Pair is a deployment tool. These are some of the deployment commands. Pair seed. It seeds the P2P state to the DHT, to the distributed hash table, and allows others to then run from that seed. If you think of BitTorrent, it's like a next-generation BitTorrent, but the applications are representations, materialised views of append-only logs which are then torrented between the peers. Pair stage is a deployment tool because it's how you release. It's all about whether you share your key. You can have a public key, you can have a private key for the applications, an internal key, say. Pair release marks releases on a core.

Pair is a JavaScript runtime. Not only is it written in JavaScript, but it is also literally a JavaScript runtime because Pair is Bear. Bear is another project that we've made at HolePunch alongside Pair. They came up together. It's a minimal JavaScript runtime for desktop and mobile. We use it in both our mobile and our desktop app. We're moving to an architecture where both the desktop and the mobile apps run the same exact code in a worker, and then the UIs talk to them, and that code runs in Bear. It's a very, very fast node-like runtime with first-class support for P2P primitives. Therefore, Pair is also a native runtime, as well as a JavaScript runtime. You can run native modules with Bear. You can write straight up C, seed that out, and others can run that from you as a peer. No infrastructure, no cloud, nothing, just the peers.

Pair is a platform.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

How Bun Makes Building React Apps Simpler & Faster
React Day Berlin 2022React Day Berlin 2022
9 min
How Bun Makes Building React Apps Simpler & Faster
BUN is a modern all-in-one JavaScript runtime environment that achieves new levels of performance. It includes BUN dev, a fast front-end dev server, BUN install, a speedy package manager, and BUN run, a fast package runner. BUN supports JSX, has optimized React server-side rendering, and offers hot module reloading on the server. The priorities for BUN include stability, node compatibility, documentation improvement, missing features in BUN install, AST plugin API, native Windows support, Bundler and Minifier optimization, and easier deployment to production. BUN's AST plugin API allows for bundle-time JavaScript execution and embedding code, potentially inspiring new frameworks.
Node.js Compatibility in Deno
Node Congress 2022Node Congress 2022
34 min
Node.js Compatibility in Deno
Deno aims to provide Node.js compatibility to make migration smoother and easier. While Deno can run apps and libraries offered for Node.js, not all are supported yet. There are trade-offs to consider, such as incompatible APIs and a less ideal developer experience. Deno is working on improving compatibility and the transition process. Efforts include porting Node.js modules, exploring a superset approach, and transparent package installation from npm.
Bun, Deno, Node.js? Recreating a JavaScript runtime from Scratch - Understand magic behind Node.js
Node Congress 2023Node Congress 2023
29 min
Bun, Deno, Node.js? Recreating a JavaScript runtime from Scratch - Understand magic behind Node.js
The Talk explores the magic behind Node.js and delves into its components, including V8, libuv, and the C++ bridge. It discusses the workflow and execution process, the use of NodeMod, and the understanding of console functions. The Talk also covers Node.js functions and scheduling, the introduction of runtimes, and the collaboration between JavaScript runtimes. It concludes with insights on content production, the choice of Node.js, and the inspiration behind it.
Eval all the strings! - Hardened JavaScript
Node Congress 2023Node Congress 2023
8 min
Eval all the strings! - Hardened JavaScript
NPM packages can be potentially dangerous, so it's important to be proactive in managing them. Lava Mode allows you to detect and investigate suspicious packages before deploying your app. Lavamote prevents unauthorized access to sensitive resources by isolating dependencies and using hardened JavaScript. Lava Mode makes it easier to analyze obfuscated files and understand their actions.
The Future of JavaScript Runtimes
Node Congress 2022Node Congress 2022
34 min
The Future of JavaScript Runtimes
Today's Talk explores the future of JavaScript runtimes, their evolution, and impact on software development. It discusses the historical trends of JavaScript, the adoption of new tools and libraries, and the convergence of Node and Deno. The emergence of isolate clouds and their potential to replace traditional VMs and containers is also highlighted. Additionally, the talk touches on the possibilities of JavaScript in exotic use cases, its impact on machine learning, and the potential for TypeScript to become the de facto language for JavaScript development.
Roll you own JavaScript runtime
Node Congress 2023Node Congress 2023
21 min
Roll you own JavaScript runtime
This Talk introduces Deno, a custom JavaScript runtime similar to Node.js, and discusses the benefits of using a custom runtime. It explores the process of building a custom runtime with Deno in Rust, including the integration with Cargo and the ability to mix and match crates and APIs. The Talk also covers the implementation of the setTimeout function in both Run.js and Runtime.js, and provides examples of how to fix errors and implement additional functions. Overall, the Talk highlights the flexibility and possibilities of creating custom runtimes with Deno.

Workshops on related topic

Build Peer-to-Peer Applications with Pear Runtime
JSNation 2024JSNation 2024
152 min
Build Peer-to-Peer Applications with Pear Runtime
WorkshopFree
David Mark Clements
David Mark Clements
Learn how to rapidly build peer-to-peer applications with Pear Runtime. No servers required. Understand peer-to-peer paradigms and construct applications from well-defined building blocks. This workshop will cover how to create both Desktop and Terminal applications (with discussion for Mobile) that work entirely peer-to-peer from anywhere in the world. By the end of this workshop you should know how to build a new type of highly scalable application with entirely reduced infrastructural costs (~0) along with suitable architectures and best practices for peer-to-peer applications. From the creator of Pear Runtime and the company that brings us keet.io. Table of content:- Introducing Pear- Initial Q & A- Getting Setup- Creating a Pear Desktop Application- Sharing a Pear Application- Running a Pear Application- Creating a Pear Terminal Application- Releasing a Pear Application- Architectural Discussions- Wrap-up Q & A