@vicecommerce/medusa-file-r2

1.1.1 • Public • Published

Medusa Cloudflare R2 Plugin Documentation

The Medusa Cloudflare R2 plugin is a simple and easy-to-use plugin that allows you to use Cloudflare R2 as the storage provider for Medusa.

Table of Contents

  1. Installation
  2. Configuration
  3. Obtaining Credentials
  4. Usage
  5. Credits

Installation

To get started with the Medusa Cloudflare R2 plugin, you will first need to install the package using npm:
npm i @vicecommerce/medusa-file-r2

Configuration

After installing the plugin, you need to configure it in your Medusa project. You can do this by adding the following object to the `medusa-config.js` file:
{
  resolve: "@vicecommerce/medusa-file-r2",
  options: {
    account_id: process.env.R2_ACCOUNT_ID,
    bucket: process.env.R2_BUCKET_NAME,
    public_url: process.env.R2_PUBLIC_URL,
    access_key_id: process.env.R2_ACCESS_KEY,
    secret_access_key: process.env.R2_SECRET_KEY,
  },
}

Make sure to replace the values in the options object with the appropriate environment variables containing your Cloudflare R2 credentials.

Obtaining Credentials

To use the Medusa Cloudflare R2 plugin, you will need the following credentials:
  1. Account ID
  2. Bucket Name
  3. Public URL
  4. Access Key ID
  5. Secret Access Key
You can obtain these credentials by logging into your Cloudflare account and navigating to the R2 Storage section. If you do not already have a Cloudflare account, you will need to sign up for one.

For detailed instructions on obtaining your Cloudflare R2 credentials, please refer to the official Cloudflare R2 documentation.

example env

Usage

Once you have installed and configured the plugin, you can use it to store files with Medusa. The plugin will automatically handle uploading and deleting files on your Cloudflare R2 storage.

For example, when using Medusa to manage product images, the images will be uploaded to your specified Cloudflare R2 bucket.

Credits

The Medusa Cloudflare R2 plugin is based on the original work by contrebande-labs.

Package Sidebar

Install

npm i @vicecommerce/medusa-file-r2

Weekly Downloads

5

Version

1.1.1

License

MIT

Unpacked Size

8.13 kB

Total Files

3

Last publish

Collaborators

  • viceverse