Is ipfs only used for static html in the web?

Is ipfs only used for static html?ipfs can guarantee to the html can be visited by p2p,but it cannot ensure the server behind html can be visited.Is there a method to create a dynamic web html with database?

IPFS is not only for static sites, but it does take a bit of extra work to get dynamic sites.

Depending on what kind of dynamic behavior you need, client-side scripting would probably be sufficient if the changes donā€™t need to be visible to everyone.

If you want to use only IPFS technologies, you will need to use IPNS to allow the page to change. This is what I do with this page that has an index of IPFS/IPNS pages. I have a computer run a cron job that does the scan, rebuilds the site contents, then publishes (with ipfs name publish key=$KEY $HASH). Be warned: IPNS is unfortunately less polished and slower than the rest of IPFS. Expect additional delays, possibly minutes, in page loads.

You can have a hybrid site, using HTTP(S) for the dynamic content and IPFS for the content that changes less often, or use the HTTP(S) server to provide IPFS hashes of the actual content, like d.tube does.

I am sure there are other ways of doing dynamic sites. I think it should be possible to use pubsub with IPFS/IPNS for dynamic content. Same for hybrid IPFS/blockchain sites.

@teknomunk My understanding that the ā€˜publishā€™ command to disseminate a new IPNS is what would take minutes (for the same sort of reason DNS updates take time to propagate), but that once propagated the ā€˜getā€™ operations (requests) for the IPNS resources would then be just about as fast as a non-IPNS CID. Someone please correct me if this is wrong.

Yes.If you use ipns to realize dynamic web,how can your users send messages to show?
If you realized by http server, it is obviously that can be ā€œa point of failureā€ ,especially restricted the network in some countries.

If you donā€™t want the single point of failure that a HTTP server would introduce, I think pubsub will need to be used, but still have a fallback HTTP(S) server that relays pubsub messages for everyone that is not using a local IPFS client. The way I envision it would work is:

  • A server that has subscribed to a particular PubSub topic and listens for client messages and provides periodic /ipfs/ links for dynamic content updates.
  • IPNS site that contains a json file for the dynamic content
  • A client javascript library that connects to the local IPFS API (http://127.0.0.1:5001/api/v0/pubsub/sub) or a fallback relay server, receives updates to the dynamic content, submits messages to the server, and updates the client display with the server updates.

Now, I havenā€™t put such a system together myself, so this is something that should work and not something I know with certainty that it works. I would like such a system to add a comments section to my personal blog on IPFS, so I will probably create a proof of concept of this, but Iā€™ve got no timeline.

1 Like