nft.storage

Free decentralized storage and bandwidth for NFTs on IPFS and Filecoin.

nft.storage screenshot

Table of Contents

Client Libraries

The JS client library is the official and supported client to nft.storage. Other libraries listed have been generated from the OpenAPI schema and are experimental, unsupported and may not work at all!

HTTP API

Check out the HTTP API documentation.

Developer Tools

We’ve created some scripts to help developers with bulk imports, status checks, file listings and more:

https://github.com/nftstorage/nft.storage-tools

Development

Instructions for developers working on the nft.storage API and website.

Getting Started

We use yarn in this project and commit the yarn.lock file.

  1. Install dependencies.
    # install all dependencies in the mono-repo
    yarn
    # setup git hooks
    npx simple-git-hooks
    
  2. Follow the getting started guides in /packages/api and /packages/website.
  3. Run locally by following the instructions below.

Local environment configuration

In the root folder create a .env file with the following:

# Cloudflare
CF_TOKEN=<token>
CF_ACCOUNT_ID=<account-id>

# IPFS Cluster
CLUSTER1_API_URL = https://nft.storage.ipfscluster.io/api/
CLUSTER1_BASIC_AUTH_TOKEN=<token>

CLUSTER2_API_URL = https://nft2.storage.ipfscluster.io/api/
CLUSTER2_BASIC_AUTH_TOKEN=<token>

# Postgrest API
DATABASE_URL=http://localhost:3000
# Create a token, for role "postgres", using secret value PGRST_JWT_SECRET from 'packages/api/db/docker/docker-compose.yml'
# https://postgrest.org/en/v8.0/tutorials/tut1.html#step-3-sign-a-token
DATABASE_TOKEN=<token>

PROD_DATABASE_URL=https://db.nft.storage
PROD_DATABASE_TOKEN=<token>

STAGING_DATABASE_URL=https://db-staging.nft.storage
STAGING_DATABASE_TOKEN=<token>

# Postgres Database
DATABASE_CONNECTION=postgresql://postgres:postgres@localhost:5432/postgres

PROD_DATABASE_CONNECTION=<connection-string>

STAGING_DATABASE_CONNECTION=<connection-string>

# Pinata
PINATA_JWT=<token>

# Sentry.io
SENTRY_DSN=<dsn>
SENTRY_TOKEN=<token>
# Note: tokens can be created here https://sentry.io/settings/account/api/auth-tokens/ and need the following scopes `event:admin` `event:read` `member:read` `org:read` `project:read` `project:releases` `team:read`.
SENTRY_UPLOAD=false # toggle for sentry source/sourcemaps upload (capture will still work)

# dag cargo
DAG_CARGO_HOST=<ip>
DAG_CARGO_DATABASE=<db-name>
DAG_CARGO_USER=<db-user>
DAG_CARGO_PASSWORD=<db-password>

Production vars should be set in Github Actions secrets.

Running Locally

To run nft.storage locally, start the following processes:

  1. Local IPFS Cluster (docker-compose up in your cluster home dir).
  2. Localtunnel to expose cluster (yarn lt in /packages/api).
  3. API server (yarn dev --env USER in /packages/api).
  4. Web server (yarn dev in /packages/website).

The site should now be available at http://localhost:4000

Release

Release Please automates CHANGELOG generation, the creation of GitHub releases, and version bumps for our packages. Release Please does so by parsing your git history, looking for Conventional Commit messages, and creating release PRs.

What’s a Release PR?

Rather than continuously releasing what’s landed to our default branch, release-please maintains Release PRs:

These Release PRs are kept up-to-date as additional work is merged. When we’re ready to tag a release, we simply merge the release PR.

When the release PR is merged the release job is triggered to create a new tag, a new github release and run other package specific jobs. Only merge ONE release PR at a time and wait for CI to finish before merging another.

Release PRs are created individually for each package in the mono repo.

How should I write my commits?

Release Please assumes you are using Conventional Commit messages.

The most important prefixes you should have in mind are:

Contributing

Feel free to join in. All welcome. Open an issue!

License

Dual-licensed under MIT + Apache 2.0