# strapi-provider-upload-ipfs-storage

> IPFS upload provider for Strapi

Latest version **1.1.0** (published 2023-01-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install strapi-provider-upload-ipfs-storage
pnpm add strapi-provider-upload-ipfs-storage
yarn add strapi-provider-upload-ipfs-storage
bun add strapi-provider-upload-ipfs-storage
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-01-22 |
| First published | 2022-11-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=14.19.1 <=18.x.x |
| Dependencies | 1 |
| Unpacked size | 14.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Maintainers | alexbakers |
| Keywords | upload, ipfs, web3, filebase, pinata, fleek, strapi, lighthouse |

## Links

- npm: https://www.npmjs.com/package/strapi-provider-upload-ipfs-storage
- Repository: https://github.com/alexbakers/strapi-provider-upload-ipfs-storage
- Issues: https://github.com/alexbakers/strapi-provider-upload-ipfs-storage/issues
- npm.io page: https://npm.io/package/strapi-provider-upload-ipfs-storage

## Dependencies (1)

- [ipfs-storage](https://npm.io/package/ipfs-storage.md) ^1.2.1

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2023-01-22
- 1.0.6 — 2022-12-28
- 1.0.5 — 2022-12-24
- 1.0.4 — 2022-11-26
- 1.0.3 — 2022-11-21
- 1.0.2 — 2022-11-05
- 1.0.1 — 2022-11-05
- 1.0.0 — 2022-11-05

## README

# Strapi Provider Upload IPFS Storage

<img alt="strapi-provider-upload-ipfs-storage" src="https://raw.githubusercontent.com/alexbakers/strapi-provider-upload-ipfs-storage/main/public/screenshot.png" />

IPFS (Filebase, Pinata, Fleek, Web3, Lighthouse) provider for Strapi uploads.

## Installation

```bash
# using yarn
yarn add strapi-provider-upload-ipfs-storage

# using npm
npm install strapi-provider-upload-ipfs-storage --save
```

### Providers Configuration

`./config/plugins.js`

```js
module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: "strapi-provider-upload-ipfs-storage",
      providerOptions: {
        defaultStorage: "filebase",
        filebase: {
          // https://console.filebase.com/keys
          key: env("FILEBASE_KEY"),
          secret: env("FILEBASE_SECRET"),
          bucket: env("FILEBASE_BUCKET"),
        },
        pinata: {
          // https://app.pinata.cloud/keys
          jwt: env("PINATA_JWT"),
        },
        fleek: {
          // https://app.fleek.co/#/settings/general/profile
          key: env("FLEEK_KEY"),
          secret: env("FLEEK_SECRET"),
          bucket: env("FLEEK_BUCKET"),
        },
        web3: {
          // https://web3.storage/tokens/
          token: env("WEB3_TOKEN"),
        },
        lighthouse: {
          // https://files.lighthouse.storage/dashboard/apikey
          token: env("LIGHTHOUSE_TOKEN"),
        },
      },
    },
  },
  // ...
});
```

`.env`

```bash
FILEBASE_KEY=""
FILEBASE_SECRET=""
FILEBASE_BUCKET=""

PINATA_JWT=""

FLEEK_KEY=""
FLEEK_SECRET=""
FLEEK_BUCKET=""

WEB3_TOKEN=""

LIGHTHOUSE_TOKEN=""
```

## Configuration Strapi + Filebase [ [tutorial](https://docs.filebase.com/configurations/third-party-configurations/backup-client-configurations/strapi-provider-plugin) ]

<img alt="Configuration Strapi + Filebase" src="https://raw.githubusercontent.com/alexbakers/strapi-provider-upload-ipfs-storage/main/public/filebase-provider.png" />

| Variable | Type   | Description            | Required |
| -------- | ------ | ---------------------- | -------- |
| key      | string | Filebase access key    | yes      |
| secret   | string | Filebase access secret | yes      |
| bucket   | string | Filebase bucket name   | yes      |

```js
module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: "strapi-provider-upload-ipfs-storage",
      providerOptions: {
        defaultStorage: "filebase",
        filebase: {
          // https://console.filebase.com/keys
          key: env("FILEBASE_KEY"),
          secret: env("FILEBASE_SECRET"),
          bucket: env("FILEBASE_BUCKET"),
        },
      },
    },
  },
  // ...
});
```

## Configuration Strapi + Pinata

<img alt="Configuration Strapi + Pinata" src="https://raw.githubusercontent.com/alexbakers/strapi-provider-upload-ipfs-storage/main/public/pinata-provider.png" />

| Variable | Type   | Description                      | Required |
| -------- | ------ | -------------------------------- | -------- |
| jwt      | string | Pinata JWT (Secret access token) | yes      |

```js
module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: "strapi-provider-upload-ipfs-storage",
      providerOptions: {
        defaultStorage: "pinata",
        pinata: {
          // https://app.pinata.cloud/keys
          jwt: env("PINATA_JWT"),
        },
      },
    },
  },
  // ...
});
```

## Configuration Strapi + Fleek

<img alt="Configuration Strapi + Fleek" src="https://raw.githubusercontent.com/alexbakers/strapi-provider-upload-ipfs-storage/main/public/fleek-provider.png" />

| Variable | Type   | Description                            | Required |
| -------- | ------ | -------------------------------------- | -------- |
| key      | string | Fleek Storage API key                  | yes      |
| secret   | string | Fleek Storage API secret               | yes      |
| bucket   | string | Fleek bucket name (e.g. 71a...-bucket) | yes      |

```js
module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: "strapi-provider-upload-ipfs-storage",
      providerOptions: {
        defaultStorage: "fleek",
        fleek: {
          // https://app.fleek.co/#/settings/general/profile
          key: env("FLEEK_KEY"),
          secret: env("FLEEK_SECRET"),
          bucket: env("FLEEK_BUCKET"),
        },
      },
    },
  },
  // ...
});
```

## Configuration Strapi + Web3

<img alt="Configuration Strapi + Web3" src="https://raw.githubusercontent.com/alexbakers/strapi-provider-upload-ipfs-storage/main/public/web3-provider.png" />

| Variable | Type   | Description            | Required |
| -------- | ------ | ---------------------- | -------- |
| token    | string | Web3 Storage API Token | yes      |

```js
module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: "strapi-provider-upload-ipfs-storage",
      providerOptions: {
        defaultStorage: "web3",
        web3: {
          // https://web3.storage/tokens/
          token: env("WEB3_TOKEN"),
        },
      },
    },
  },
  // ...
});
```

## Configuration Strapi + Lighthouse

<img alt="Configuration Strapi + Lighthouse" src="https://raw.githubusercontent.com/alexbakers/strapi-provider-upload-ipfs-storage/main/public/lighthouse-provider.png" />

| Variable | Type   | Description                  | Required |
| -------- | ------ | ---------------------------- | -------- |
| token    | string | Lighthouse Storage API Token | yes      |

```js
module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: "strapi-provider-upload-ipfs-storage",
      providerOptions: {
        defaultStorage: "lighthouse",
        lighthouse: {
          // https://files.lighthouse.storage/dashboard/apikey
          token: env("LIGHTHOUSE_TOKEN"),
        },
      },
    },
  },
  // ...
});
```

### Security Middleware Configuration

Due to the default settings in the Strapi Security Middleware you will need to modify the `contentSecurityPolicy` settings to properly see thumbnail previews in the Media Library. You should replace `strapi::security` string with the object bellow instead as explained in the [middleware configuration](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/required/middlewares.html#loading-order) documentation.

`./config/middlewares.js`

```js
module.exports = [
  // ...
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "connect-src": ["'self'", "https:"],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
            "dl.airtable.com",
            "*.ipfs.dweb.link", // ipfs.tech
            "*.ipfs.cf-ipfs.com", // cloudflare.com
            "*.ipfs.w3s.link", // web3.storage
          ],
          "media-src": [
            "'self'",
            "data:",
            "blob:",
            "dl.airtable.com",
            "*.ipfs.dweb.link", // ipfs.tech
            "*.ipfs.cf-ipfs.com", // cloudflare.com
            "*.ipfs.w3s.link", // web3.storage
          ],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  // ...
];
```

## Links

- [Strapi website](https://strapi.io/)
- [IPFS website](https://ipfs.tech/)
- [Filebase website](https://filebase.com/)
- [Pinata website](https://pinata.cloud/)
- [Fleek website](https://fleek.co/)
- [Web3 website](https://web3.storage/)
- [Lighthouse website](https://lighthouse.storage/)

---

`(c)` Alex Baker

---
_Source: https://npm.io/package/strapi-provider-upload-ipfs-storage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
