Tutorial: How to create your own distributed website in just a few seconds

The Interplanetary File System (IPFS) is a peer-to-peer hypermedia protocol aimed to replace HTTP with a name-based system. One of the main use cases for this new technology is that it allows you to host distributed websites.

However, IPFS currently presents two major barriers when it comes to the setup of these distributed websites:

  1. The name/address of the distributed website is far from human readable
  2. The upload of pages isn’t easy, and most of the time the website loads slowly

The first problem will be addressed over the coming weeks, as part of an additional article around the search engine of Dweb.page. The current article will focus on how to host distributed web pages with Dweb.page in literally a couple of seconds!

There are several tutorials on how to do this (e.g. here or here). In these tutorials, you usually need to install IPFS on your computer, make sure that your website contains only relative links and upload the whole folder to your IPFS gateway (with ipfs add -r folder/). This allows your distributed website to load fast on your local gateway, but once your site is requested from a different gateway like ipfs.io/ipfs/, it takes quite a while to load the page.

The reason for this slow loading is because once your hash is requested and loaded from the public gateway (by entering ipfs.io/ipfs/yourAwesomeHash), it starts requesting other necessary hashes from the network (e.g. the hash containing the CSS or Javascript file). And even though the propagation of hashes through the IPFS network has been improving, it still takes a some time if your website is not fully distributed yet. This initial loading time is just something people aren’t used to. Additionally, if you click on a link, the whole process starts from the beginning, and if one part of your site, like the CSS file, is deleted from the IPFS network, the whole site will stop working.

The best way to solve this is to create a single page application (SPA) and put all the code into one HTML file. This way your webpage loads much faster on the distributed web and you don’t have any issues with links. Of course, creating a small hello world website by putting all the code into one HTML file is fine, but for a big project, you might want to use something else.

...

Read the Full Article

This post was originally published on https://medium.com/@davidhawig?source=rss-5fe0790325f2------2. The IOTA-News Community curates, examines, and summarizes news from external services while producing its own original material. Copyrights from external sources will be credited as they pertain to their corresponding owners. The purpose is to make use of 3rd party content or pictures as either allusion or promotional endorsement of mentioned sites. If you have a claim of copyright infringement with respect to material, please mail to support[at]iota-news.com. IOTA-News.com is a community run website and is NOT affiliated with the IOTA Foundation in any way.

You might also like

Join our Telegram Channel

for IOTA News in realtime!

Do you want to join?

Download the Telegram  app  here