The Beginners Guide to Beaker Browser & P2P Peer to Peer Web Apps
Hey there, Everyone.
How is it going?
Welcome to 8bitmen.com
This article is a comprehensive write-up on a decentralized P2P web browser called the Beaker browser. It also answers all your queries like what are p2p web apps? How do they work? What is the underlying flow & architecture? How is beaker browser different in contrast to the traditional web browsers like Mozilla & Chrome etc?
So, without any further ado. Let’s get on with it.
1. What is Beaker Browser?
Completely averting the need for any third-party server, which is ideally required to host websites.
With beaker browser, our websites are ready to launch & be shared with the world with just one click of a button as soon as it is designed.
The websites run over a protocol known as DAT as opposed to a traditional web protocol like HTTP.
2. What is DAT Protocol?
Dat protocol is a user-centric web protocol. A protocol of the modern web apps, specifically designed to facilitate file sharing between users directly, from one user machine to another.
Just like we do via torrent. Dat is a protocol of the decentralized web. Users can share files with each other directly connecting their local machines instead of going through a third-party server.
I will talk more about DAT further down the article. For now, let’s focus on the beaker browser.
Alright!! Besides, DAT we can also browse websites running on HTTP & HTTPS on beaker. So, there is no need for switching over to other browsers for browsing websites running on different web protocols. Wisely thought.
3. What are Some of the Unique Features of Beaker Browser?
Beaker browser is designed keeping in mind a less technical savvy person like me. Via beaker, the end user should be able to create his website & get it running without any hassle.
Also, I would also like to state that the project is it’s in infancy stage & comparing the sites built with it, with traditional websites & apps won’t be just.
Let’s look into some of the really cool out of the box features offered by the beaker browser.
1. It has an inbuilt website editor: Users can write code for their website from scratch or can use a pre-defined website template or can fork/copy the design of a website. Modify it & host it.
Fork is a more technical word for taking your own copy of something. If you are acquainted with GitHub, then you know what forking is.
2. Beaker browser also provides an API facilitating the creation of dynamic websites commonly called web apps.
Via the API the sites can keep the data updated. The API facilitates development of sites like Twitter, a microblogging site, but with some limitations. More on that further down the article.
3. Beaker offers features like live reloading, offline syncing for websites.
As stated earlier, with the help of its P2P Web API the websites aren’t just static but have dynamic features too. The websites work on DAT protocol so all the features of the protocol implicitly come along.
3. How Do Websites on Beaker Browser Really Work? Step by Step Explanation
The underlying flow is exactly along the lines of sharing files via torrent. As we do it via BitTorrent etc. I am sure we have all downloaded files via torrents. Haven’t we?
Let’s understand the entire architectural flow of how beaker websites work. We can, naturally, also call them as peer to peer websites. If you are a bit hazy on what a p2p network is & how it works?
I’ve written an in-depth article on it. Here you go.
3.1 How Do P2P Peer to Peer Websites Work?
A user creates a website via the browser. As soon as the website is created. With the click of a button, the website is hosted in the same machine, in which it is created, via the server embedded in the beaker browser.
Alright!! Now after the website is up. How will the world know we have a super awesome website?
We share the unique url of the site, with the people we intend to share. Only those people will be able to access your website. Just like we access the files with the help of a torrent file.
The address of the resources is given in the torrent files. That gets loaded into the desktop torrent client & the data starts getting downloaded from the addresses.
Now, I would like to state that there is no anonymity in this kind of network. Any can have a peek at your IP address when you visit a peer to peer website. Since things are public.
They can also fork your website have a copy of their own. Maybe modify it, at their whim & host it for self.
Though the data shared is completely encrypted & cannot be intercepted. Also, no one can modify your website unless he gets your private key.
3.2 What are the Underlying Concepts & Architecture of a P2P Peer to Peer website?
The underlying concepts as stated are same as using torrent files. When we visit a website via beaker browser, we temporarily host it with our machines too. Hosting is also called seeding.
Though instead of the entire website being hosted, only the files we access in our browser windows are hosted.
Via the browser settings, we can also set the time limit of hosting a particular website. We can choose to host it for minutes, or days or years or eternally.
3.3 What if a Machine Hosting a Website Goes Down?
Making our machines available for hosting content keeps the network healthy. And important resources widely available, reducing the risk of the entire content going down, just in case the original host is offline. Just good network etiquettes.
The machines hosting our content is known as peers. More the peers, more highly available is the data. The network is more consumer-driven as opposed to being corporate driven.
More peers, less single points of failure. Even if several machines go down, the content is still up.
Besides assisted by peer to peer hosting, with beaker browser we can set up a seeding server in our own machine. And can also host our websites, on a service like Hashbase.
Hashbase is a service, which hosts our p2p website on their server. To add an extra layer of going offline protection.
All, the p2p peer to peer websites are linked with each other in a decentralized architecture. If you are not clear, what the decentralized architecture exactly means? I have written an article on it in depth. This will clear all your queries. Here you go.
You might have already gone through my in-depth article of what is a peer to peer network.
Decentralized web is a real fun, person to person web. Share your content with your friends via your unique link. Only the people with the unique link have access to the website.
In the decentralized web, the sites are up even in case of a nuke event or a zombie apocalypse since there are no single points of failure.
3.4 How Do We Discover P2P Peer to Peer Website or Apps?
If we talk about the regular traditional website running over HTTP, they get registered with the search engines like Google, Bing. Search engines index them & eventually we discover them via search engines.
We discovered torrents via torrent search engines. They are also known as the UDDI registry if you are familiar with the web services jargon.
But in the case of P2P websites since there is no universal, popular search engine. There is no way to discover them. Though there are some places like Hashbase, Explore beaker & browse Neocities but still the sites remain undiscovered at large.
The cult of the decentralized web is still in its infancy & gradually gaining traction.
4. Are Beaker P2P Peer to Peer Web Apps Completely Static? Or Do they have Dynamic Features Too?
Alright!! I get it the sites are connected directly. But!! How exactly do they get updated without a central server?
Let’s understand this with the help of a use case. A microblogging website like Twitter built on dat protocol.
You might remember Beaker sites are built on DAT protocol. Dat is a protocol for the modern web facilitating the development of peer to peer web apps.
So, say n people assemble & want to create a social microblogging website like Twitter, but in a decentralized peer to peer way.
I create a website, my friend John creates his DAT website, his friend Rob creates his website. We share all the unique urls with each other. So, now we can see each other’s site but how will I get the updated data of all the three friends when I refresh my website.
When we create a DAT website. The website contains .json files where the data is stored. So, say I create my profile page. It will have a profile.json with my name & other details.
When I follow John & Rob, it will store their sites unique url in the JSON file of my website.
Now when I click refresh beaker browser will go through the JSON file in the root of my website. Traverse through all the followed user’s sites addresses & fetch the updated latest content from them.
Cool Isn’t it?
But this architecture has a limitation
4.1 P2P Peer to Peer Web Apps Have Certain Architectural Limitations
I knew John’s & Rob’s websites addresses so I navigated to their profiles & followed them. But what if I want to follow someone, whose website address I don’t have?
I will face problems with implementing any feature in context to a global discovery. Like trending hashtags and stuff. Simply because I don’t have the address of the profiles out there on the web. Everyone is just sitting there in the dark.
This precipitates the need for a custom decentralized architecture called the Federated architecture. If you need to have a deeper understanding of how things work.
With the help of federated architecture, we can subscribe to pods & then pods can link with each other. Creating a larger network.
Another common solution would be to integrate a P2P web crawler with the regular search engines. They would crawl through the web & register all the JSON files of every p2p website.
More On the Blog
Well, Guys!! this was pretty much it on Beaker browser & P2P peer to peer websites. I am sure this write-up gave you a good insight into peer to peer web applications & beaker browser. And how things fit together.
If you still have any doubts, do let me know in the comments. In case, if you liked the articles, do share it with your geek friends.
See you, next time.
- Distributed Systems, Scalability & System Design #1 – Heroku Client Rate Throttling
- Zero to Software/Application Architect – Learning Track
- Java Full Stack Developer – The Complete Roadmap – Part 2 – Let’s Talk
- Java Full Stack Developer – The Complete Roadmap – Part 1 – Let’s Talk
- Best Handpicked Resources To Learn Software Architecture, Distributed Systems & System Design