Website with Fluence backend and static resources on IPFS


Fluence nodes are stateful but it is wasteful to store website (or something else) static resources on them. We can use decentralized storage like IPFS to store static resources and save the decentralized state of the whole system.


How To

First of all, we need already written frontend interacting with Fluence nodes.

And then let's upload directory with built frontend code:

IPFS_ADDR=$(host | awk '/has address/ { print $4 }')
ipfs --api /ip4/$IPFS_ADDR/tcp/5001 add -r path/to/built/frontend

IPFS_ADDR - is a ip address

This command will return a hash of directory. We can check if the directory is uploaded by opening a link with this hash:<IpfsHash>

That's it! Now your frontend code is available with this link:<IpfsHash>/index.html

Note, that your entrypoint is not index.html, change the link to right one.