2

I'm working on a decentralized p2p chat system that runs exclusively in the browser. There literally is no server to speak of. I want to persist message history, and IPFS looks like a good way to do that. However, every tutorial and example I can find requires a node.js server, React or Angular (per this)--none of which will work with what I've built.

I have identified some public IPFS gateways that I could potentially use here. But without a server hosting the IPFS api, and no html/javascript exclusive examples, how can I build this?

One idea I was going to explore was running node with express in the browser, which I've done in the past for other projects not using IPFS. But I would like to avoid that if possible.

Is using IPFS without a server hosting the page impossible at this time? What am I missing/overlooking?

1 Answer 1

4

I found my own answer and was able to successfully upload and retrieve a file from IPFS using js-ipfs.

One caveat is the example code in index.html at the GitHub link is referencing a local node.js module.

Simply replace:

<script src="./node_modules/ipfs/dist/index.min.js"></script>

With:

<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"></script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.