Skip to content

Commit 98a1112

Browse files
committed
add conclusion
1 parent c8fbf70 commit 98a1112

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

docs/how-to/ipfs-in-web-apps.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: IPFS in web applications
3-
description: How to develop applications that use IPFS in web browsers, including IPFS retrieval and pinning in browsers using implementations such as Helia.
3+
description: How to develop applications that use IPFS on the Web including addressing by CID, merkleizing, retrieval, providing, and CAR files with Helia.
44
---
55

66
# IPFS in web-applications and resource-constrained environments
@@ -23,7 +23,7 @@ There are good reasons for this like security and resource management, but ultim
2323

2424
As a developer, IPFS exposes three main operations for interacting with the network:
2525

26-
- **Addressing data with CIDs** (also known as merkleizing): taking arbitrary data and encoding so its addressable by CID. For example, given a file and encoding it so it can be addressed by a CID.
26+
- **Addressing data with CIDs** (also known as **merkleizing**): taking arbitrary data and encoding so its addressable by CID. For example, given a directory of files, merkleizing it so it can be addressed and retrieved by CID.
2727
- **Retrieving data by CID**: given a CID, IPFS finds providers (peers who share the block), connects to them, fetches the blocks, and verifies that the retrieved data is what the CID represents.
2828
- **Providing data by CID**: making data addressed by a CID retrievable by other peers, either by running a node or with a pinning service.
2929

@@ -95,7 +95,7 @@ Instead, you should provide data from a long-running server that runs reliably a
9595

9696
The Content Archive format is a way of packaging up content addressed data into archive files that can be easily stored and transferred over the network. You can think of them like TAR files that are designed for storing collections of content addressed data.
9797

98-
So why would you want to use CAR files?
98+
**So why would you want to use CAR files?**
9999

100100
One of the main reasons is related to [CID determinism](#cid-determinism). As mentioned above, the same data can result in different CIDs, which can make it difficult to verify data without its content addressed representation. By packaging up the data into a CAR file, you can upload the CAR to multiple pinning services and nodes knowing they are providing the same CIDs
101101

@@ -105,3 +105,23 @@ Car files are a great way to store content-addressed data in a way that is easy
105105
See the Pen <a href="https://codepen.io/2color/pen/EaYoegX">
106106
CAR export with Helia and dag-cbor</a> by Daniel Norman (<a href="https://codepen.io/2color">@2color</a>)
107107
</iframe>
108+
109+
At the time of writing, not all pinning services support CAR files, but it is a feature that is being added to more and more services. Therefore, it is a good idea to check the documentation for the pinning service you are using to see if it supports CAR files.
110+
111+
## Conclusion
112+
113+
This guide has covered the essential aspects of using IPFS in web applications:
114+
115+
- The main operations: addressing/merkleizing data with CIDs, retrieving data, and providing data.
116+
- The challenges and limitations of using IPFS in browser environments.
117+
- Practical examples using modern tools like [Helia](https://github.com/ipfs/helia) and [Verified Fetch](https://www.npmjs.com/package/@helia/verified-fetch).
118+
- Best practices for handling data persistence through pinning services and CAR files.
119+
120+
When building web applications with IPFS, remember these key takeaways:
121+
122+
1. Use client-side merkleization (addressing) when onboarding new data to IPFS, but rely on pinning services or IPFS nodes for providing data.
123+
1. Be mindful of CID determinism when working with files and structured data.
124+
1. Consider using CAR files where possible for storage and transport of content-addressed data.
125+
1. Use Verified Fetch for simple retrieval or Helia for more complex IPFS interactions.
126+
127+
By following these guidelines, you can reap the benefits of IPFS while working within the constraints of the web.

0 commit comments

Comments
 (0)