Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 308baa4

Browse files
authored
docs: consolidate and update docs (#3364)
* Consolidates docs under `/docs` * Adds missing licenses, CoC, READMEs, etc * Updates docs where information was incorrect
1 parent dc2795a commit 308baa4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+909
-365
lines changed

CONTRIBUTING.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Contributing guidelines
2+
3+
IPFS as a project, including js-ipfs and all of its modules, follows the [standard IPFS Community contributing guidelines](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md).
4+
5+
We also adhere to the [IPFS JavaScript Community contributing guidelines](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) which provide additional information of how to collaborate and contribute in the JavaScript implementation of IPFS.
6+
7+
We appreciate your time and attention for going over these. Please open an issue on [ipfs/community](https://github.com/ipfs/community) if you have any question.
8+
9+
Thank you.

COPYRIGHT

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This project is transitioning from an MIT-only license to a dual MIT/Apache-2.0 license.
2+
Unless otherwise noted, all code contributed prior to 2019-11-21 and not contributed by
3+
a user listed in [this signoff issue](https://github.com/ipfs/js-ipfs/issues/2624) is
4+
licensed under MIT-only. All new contributions (and past contributions since 2019-11-21)
5+
are licensed under a dual MIT/Apache-2.0 license.

README.md

+102-3
Large diffs are not rendered by default.

packages/ipfs/docs/ARCHITECTURE.md renamed to docs/ARCHITECTURE.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
# IPFS Architecture
1+
# IPFS Architecture <!-- omit in toc -->
22

3-
![](../img/architecture.png)
3+
## Table of Contents <!-- omit in toc -->
4+
5+
- [Code Architecture and folder Structure](#code-architecture-and-folder-structure)
6+
- [Source code](#source-code)
7+
8+
![](./img/architecture.png)
49

510
[Annotated version](https://user-images.githubusercontent.com/1211152/47606420-b6265780-da13-11e8-923b-b365a8534e0e.png)
611

@@ -14,7 +19,7 @@ What does this image explain?
1419

1520
## Code Architecture and folder Structure
1621

17-
![](img/overview.png)
22+
![](./img/overview.png)
1823

1924
### Source code
2025

docs/BROWSERS.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
# Using JS IPFS in the Browser
1+
# Using JS IPFS in the Browser <!-- omit in toc -->
2+
3+
## Table of Contents <!-- omit in toc -->
4+
5+
- [Limitations of the Browser Context](#limitations-of-the-browser-context)
6+
- [Addressing Limitations](#addressing-limitations)
7+
- [Best Practices](#best-practices)
8+
- [Code Examples](#code-examples)
29

310
JS IPFS is the implementation of IPFS protocol in JavaScript. It can run on any
411
evergreen browser, inside a service or web worker, browser extensions, Electron and in Node.js.
@@ -44,8 +51,8 @@ You can find detailed information about running js-ipfs [here](https://github.co
4451

4552
## Best Practices
4653

47-
- Configure nodes for using self-hosted `*-star` signaling and transport service. When in doubt, use WebSockets ones.
48-
- Run your own instance of `*-star` signaling service.
54+
- Configure nodes for using self-hosted `*-star` signalling and transport service. When in doubt, use WebSockets ones.
55+
- Run your own instance of `*-star` signalling service.
4956
The default ones are under high load and should be used only for tests and development.
5057
- Make sure content added to js-ipfs running in the browser is persisted/cached somewhere on regular IPFS daemon
5158
- Manually `pin` or preload CIDs of interest with `refs -r` beforehand.
File renamed without changes.

docs/CONFIG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ The base64 encoded protobuf describing (and containing) the nodes private key.
202202

203203
## `Keychain`
204204

205-
We can customize the key management and criptographically protected messages by changing the Keychain options. Those options are used for generating the derived encryption key (`DEK`). The `DEK` object, along with the passPhrase, is the input to a PBKDF2 function.
205+
We can customize the key management and cryptographically protected messages by changing the Keychain options. Those options are used for generating the derived encryption key (`DEK`). The `DEK` object, along with the passPhrase, is the input to a PBKDF2 function.
206206

207207
Default:
208208
```json

docs/CORS.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# CORS <!-- omit in toc -->
2+
3+
## Table of Contents <!-- omit in toc -->
4+
5+
- [Overview](#overview)
6+
- [Configure CORS headers](#configure-cors-headers)
7+
8+
## Overview
9+
10+
Cross-origin Resource Sharing is a browser security mechanism that prevents unauthorized scripts from accessing resources from different domains.
11+
12+
By default the HTTP RPC API of js-IPFS will cause any request sent from a CORS-respecting browser to fail.
13+
14+
## Configure CORS headers
15+
16+
You can configure your node to allow requests from other domains to proceed by setting the appropriate headers in the node config:
17+
18+
```console
19+
$ jsipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://example.com"]'
20+
$ jsipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST", "GET"]'
21+
```
22+
23+
Restart the daemon for the settings to take effect.
File renamed without changes.

packages/ipfs/docs/DELEGATE_ROUTERS.md renamed to docs/DELEGATE_ROUTERS.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
# Configuring Delegate Routers
1+
# Configuring Delegate Routers <!-- omit in toc -->
2+
3+
- [What is it?](#what-is-it)
4+
- [How do I do it?](#how-do-i-do-it)
25

36
## What is it?
47

5-
Delegate routers peform tasks on behalf of nodes that may be missing functionality, so for example they may search the DHT for peers or content providers on behalf of IPFS implementations that do not have a DHT.
8+
Delegate routers perform tasks on behalf of nodes that may be missing functionality, so for example they may search the DHT for peers or content providers on behalf of IPFS implementations that do not have a DHT.
69

710
The delegate node is started and the client of the delegate calls API methods using the IPFS HTTP API client.
811

docs/DEVELOPMENT.md

+21-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Development <!-- omit in toc -->
22

3+
> Getting started with development on IPFS
4+
35
- [Clone and install dependencies](#clone-and-install-dependencies)
46
- [Run tests](#run-tests)
57
- [Lint](#lint)
6-
- [Build a dist version](#build-a-dist-version)
8+
- [Build types and minified browser bundles](#build-types-and-minified-browser-bundles)
79
- [Publishing new versions](#publishing-new-versions)
810
- [Using prerelease versions](#using-prerelease-versions)
911
- [Testing strategy](#testing-strategy)
@@ -32,14 +34,26 @@ See the scripts section of the root [`package.json`](./package.json) for more co
3234
# run all the unit tests
3335
> npm test
3436

37+
# run individual tests (findprovs)
38+
> npm run test -- --grep findprovs
39+
3540
# run just IPFS tests in Node.js
36-
> npm run test:node
41+
> npm run test -- -- -- -t node
42+
43+
# run just IPFS tests in a headless browser
44+
> npm run test -- -- -- -t browser
45+
46+
# run the interface tests against ipfs-core
47+
> npm run test:interface:core
48+
49+
# run the interface tests over HTTP against js-ipfs
50+
> npm run test:interface:http-js
3751

38-
# run just IPFS tests in a browser
39-
> npm run test:browser
52+
# run the interface tests over HTTP against go-ipfs from a browser
53+
> npm run test:interface:http-go -- -- -- -t browser
4054

41-
# run just IPFS tests in a webworker
42-
> npm run test:webworker
55+
# run the interop tests against js-ipfs and go-ipfs on the Electron main process
56+
> npm run test:interop -- -- -- -t electron-main
4357
```
4458

4559
More granular test suites can be run from each submodule.
@@ -54,7 +68,7 @@ Please run the linter before submitting a PR, the build will not pass if it fail
5468
> npm run lint
5569
```
5670

57-
## Build a dist version
71+
## Build types and minified browser bundles
5872

5973
```sh
6074
> npm run build
File renamed without changes.

docs/EARLY_TESTERS.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# Early Testers Programme
1+
# Early Testers Programme <!-- omit in toc -->
2+
3+
- [What is it?](#what-is-it)
4+
- [What are the expectations?](#what-are-the-expectations)
5+
- [Who has signed up?](#who-has-signed-up)
6+
- [How to sign up?](#how-to-sign-up)
27

38
## What is it?
49

packages/ipfs/docs/FAQ.md renamed to docs/FAQ.md

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
# FAQ
2-
3-
- [FAQ](#faq)
4-
- [Why isn't there DHT support in js-IPFS?](#why-isnt-there-dht-support-in-js-ipfs)
5-
- [Node.js](#nodejs)
6-
- [Browser](#browser)
7-
- [How to enable WebRTC support for js-ipfs in the Browser](#how-to-enable-webrtc-support-for-js-ipfs-in-the-browser)
8-
- [Is there WebRTC support for js-ipfs with Node.js?](#is-there-webrtc-support-for-js-ipfs-with-nodejs)
9-
- [How can I configure an IPFS node to use a custom `signaling endpoint` for my WebRTC transport?](#how-can-i-configure-an-ipfs-node-to-use-a-custom-signaling-endpoint-for-my-webrtc-transport)
10-
- [I see some slowness when hopping between tabs Chrome with IPFS nodes, is there a reason why?](#i-see-some-slowness-when-hopping-between-tabs-chrome-with-ipfs-nodes-is-there-a-reason-why)
11-
- [Can I use IPFS in my Electron App?](#can-i-use-ipfs-in-my-electron-app)
12-
- [Have more questions?](#have-more-questions)
1+
# FAQ <!-- omit in toc -->
2+
3+
## Table of Contents <!-- omit in toc -->
4+
5+
- [Why isn't there DHT support in js-IPFS?](#why-isnt-there-dht-support-in-js-ipfs)
6+
- [Node.js](#nodejs)
7+
- [Browser](#browser)
8+
- [How to enable WebRTC support for js-ipfs in the Browser](#how-to-enable-webrtc-support-for-js-ipfs-in-the-browser)
9+
- [Is there WebRTC support for js-ipfs with Node.js?](#is-there-webrtc-support-for-js-ipfs-with-nodejs)
10+
- [How can I configure an IPFS node to use a custom `signaling endpoint` for my WebRTC transport?](#how-can-i-configure-an-ipfs-node-to-use-a-custom-signaling-endpoint-for-my-webrtc-transport)
11+
- [I see some slowness when hopping between tabs Chrome with IPFS nodes, is there a reason why?](#i-see-some-slowness-when-hopping-between-tabs-chrome-with-ipfs-nodes-is-there-a-reason-why)
12+
- [Can I use IPFS in my Electron App?](#can-i-use-ipfs-in-my-electron-app)
13+
- [Have more questions?](#have-more-questions)
1314

1415
## Why isn't there DHT support in js-IPFS?
1516

docs/IPLD.md

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# IPLD Codecs <!-- omit in toc -->
2+
3+
## Table of Contents <!-- omit in toc -->
4+
5+
- [Overview](#overview)
6+
- [Bundled Codecs](#bundled-codecs)
7+
- [Adding additional codecs](#adding-additional-codecs)
8+
- [Next steps](#next-steps)
9+
10+
## Overview
11+
12+
The IPFS repo contains a blockstore that holds [Blocks](https://github.com/ipld/js-ipld-block). These blocks can be thought of as a [CID][] and associated byte array.
13+
14+
The [CID][] contains a `codec` property that lets us know how to interpret the byte array associated with it.
15+
16+
In order to perform that interpretation, an [IPLD Format][] must be loaded that corresponds to the `codec` property of the [CID][].
17+
18+
## Bundled Codecs
19+
20+
js-IPFS ships with three bundled codecs, the ones that are required to create and interpret [UnixFS][] structures.
21+
22+
These are:
23+
24+
1. [ipld-dag-pb](https://github.com/ipld/js-ipld-dag-pb) - used for file and directory structures
25+
2. [ipld-raw](https://github.com/ipld/js-ipld-raw) - used for file data where imported with `raw-leaves=true`
26+
3. [ipld-dag-cbor](https://github.com/ipld/js-ipld-dag-cbor) - used for general storage of JavaScript Objects
27+
28+
## Adding additional codecs
29+
30+
If your application requires support for extra codecs, you can configure them as follows:
31+
32+
1. Configure the [IPLD layer](https://github.com/ipfs/js-ipfs/blob/master/packages/ipfs/docs/MODULE.md#optionsipld) of your IPFS daemon to support the codec. This step is necessary so the node knows how to prepare data received over HTTP to be passed to IPLD for serialization:
33+
```javascript
34+
const ipfs = require('ipfs')
35+
36+
const node = await ipfs({
37+
ipld: {
38+
// either specify them as part of the `formats` list
39+
formats: [
40+
require('my-format')
41+
],
42+
43+
// or supply a function to load them dynamically
44+
loadFormat: async (format) => {
45+
return require(format)
46+
}
47+
}
48+
})
49+
2. Configure your IPFS HTTP API Client to support the codec. This is necessary so that the client can send the data to the IPFS node over HTTP:
50+
```javascript
51+
const ipfsHttpClient = require('ipfs-http-client')
52+
53+
const client = ipfsHttpClient({
54+
url: 'http://127.0.0.1:5002',
55+
ipld: {
56+
// either specify them as part of the `formats` list
57+
formats: [
58+
require('my-format')
59+
],
60+
61+
// or supply a function to load them dynamically
62+
loadFormat: async (format) => {
63+
return require(format)
64+
}
65+
}
66+
})
67+
```
68+
69+
## Next steps
70+
71+
* See [examples/custom-ipld-formats](https://github.com/ipfs/js-ipfs/tree/master/examples/custom-ipld-formats) for runnable code that demonstrates the above with in-process IPFS nodes, IPFS run as a daemon and also the http client
72+
73+
[cid]: https://www.npmjs.com/package/cids
74+
[ipld format]: https://github.com/ipld/interface-ipld-format
75+
[unixfs]: https://github.com/ipfs/specs/blob/master/UNIXFS.md

docs/MIGRATION-TO-ASYNC-AWAIT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Impact key:
88
* 🍋 medium - involved refactoring in application code
99
* 🍊 hard - complicated refactoring in application code
1010

11-
## ToC <!-- omit in toc -->
11+
## Table of Contents <!-- omit in toc -->
1212

1313
- [Migrating from callbacks](#migrating-from-callbacks)
1414
- [Migrating from `PeerId`](#migrating-from-peerid)
File renamed without changes.
File renamed without changes.

docs/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,22 @@ Whether accessed directly or over HTTP, both methods support the full [Core API]
1616

1717
## How tos and other documentation
1818

19+
* [Architecture overview](./ARCHITECTURE.md)
1920
* [How to run js-IPFS in the browser](./BROWSERS.md)
21+
* [Running js-IPFS on the CLI](./CLI.md)
2022
* [js-IPFS configuration options](./CONFIG.md)
23+
* [How to configure CORS for use with the http client](./CORS.md)
24+
* [Running js-IPFS as a daemon](./DAEMON.md)
25+
* [Configuring Delegate Routers](./DELEGATE_ROUTERS.md)
26+
* [Running js-IPFS under Docker](./DOCKER.md)
27+
* [FAQ](./FAQ.md)
28+
* [How to configure additional IPLD codecs](./IPLD.md)
29+
* [Running js-IPFS in your application](./MODULE.md)
30+
* [How to get metrics out of js-IPFS](./MONITORING.md)
2131

2232
## Development documentation
2333

34+
* [Getting started](./DEVELOPMENT.md)
2435
* [Release issue template](./RELEASE_ISSUE_TEMPLATE.md)
2536
* [Early testers](./EARLY_TESTERS.md)
2637
* [Releases](./RELEASES.md)

docs/RELEASES.md

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Releases
1+
# Releases <!-- omit in toc -->
22

3-
## Table of Contents
3+
## Table of Contents <!-- omit in toc -->
44

55
- [Release Philosophy](#release-philosophy)
66
- [Release Flow](#release-flow)
@@ -13,7 +13,7 @@
1313
- [Patch Releases](#patch-releases)
1414
- [Performing a Release](#performing-a-release)
1515
- [Release Version Numbers](#release-version-numbers)
16-
- [Pre-Releases and Release Candidates](#pre-releases-and-release-candidates)
16+
- [Release Candidates](#release-candidates)
1717

1818
## Release Philosophy
1919

@@ -100,19 +100,11 @@ Post `1.x.x` (future), MAJOR version number increments will contain BREAKING CHA
100100

101101
We do not yet retroactively apply fixes to older releases (no Long Term Support releases for now), which means that we always recommend users to update to the latest, whenever possible.
102102

103-
### Pre-Releases and Release Candidates
103+
### Release Candidates
104104

105-
Prior to or during the early stages of a release cycle, js-ipfs may release a pre-release version for users who want to try out the "bleeding edge". This typically happens when a new major feature or breaking change lands in master. When this happens is entirely at the discretion of the Lead Maintainer.
105+
Every commit to master results in the publishing of a Release Candidate. These are made available for users who want to try out the "bleeding edge" and can be installed using version numbers with the form `x.y.z-rc.n` where `x`, `y`, and `z` are the usual MAJOR, MINOR and PATCH version numbers and `n` (starting at 0) which is the number of commits to master since the last full release.
106106

107-
Pre-release version numbers take the form `x.y.z-pre.n`.
108-
109-
Where `x`, `y`, and `z` are the usual MAJOR, MINOR and PATCH version numbers and `n` (starting at 0) increments by 1 for every pre-release version that is released.
110-
111-
Following any pre-releases, at least one release candidate will be published during stage 1/2.
112-
113-
Release candidate version numbers take the form `x.y.z-rc.n`.
114-
115-
Where `x`, `y`, and `z` are the usual MAJOR, MINOR and PATCH version numbers and `n` (starting at 0) increments by 1 for every release candidate that is released.
107+
Alternatively the latest RC is tagged `next` on npm and can be installed using `npm install ipfs@next`.
116108

117109
---
118110

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/ipfs-cli/CODE_OF_CONDUCT.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Contributor Code of Conduct
2+
3+
The `js-ipfs` project follows the [`IPFS Community Code of Conduct`](https://github.com/ipfs/community/blob/master/code-of-conduct.md)

packages/ipfs-cli/CONTRIBUTING.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Contributing guidelines
2+
3+
IPFS as a project, including js-ipfs and all of its modules, follows the [standard IPFS Community contributing guidelines](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md).
4+
5+
We also adhere to the [IPFS JavaScript Community contributing guidelines](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) which provide additional information of how to collaborate and contribute in the JavaScript implementation of IPFS.
6+
7+
We appreciate your time and attention for going over these. Please open an issue on [ipfs/community](https://github.com/ipfs/community) if you have any question.
8+
9+
Thank you.

packages/ipfs-cli/COPYRIGHT

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This project is transitioning from an MIT-only license to a dual MIT/Apache-2.0 license.
2+
Unless otherwise noted, all code contributed prior to 2019-11-21 and not contributed by
3+
a user listed in [this signoff issue](https://github.com/ipfs/js-ipfs/issues/2624) is
4+
licensed under MIT-only. All new contributions (and past contributions since 2019-11-21)
5+
are licensed under a dual MIT/Apache-2.0 license.

packages/ipfs-cli/LICENSE-APACHE

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
2+
3+
http://www.apache.org/licenses/LICENSE-2.0
4+
5+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

packages/ipfs-cli/LICENSE-MIT

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
The MIT License (MIT)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

0 commit comments

Comments
 (0)