Overview
Icon for MinIO (Vymalo)

MinIO (Vymalo)

Self-hosted MinIO file storage

MedusaJS Minio File Storage Provider

πŸ—„οΈ Seamless MinIO file storage integration for MedusaJS - Self-hosted, S3-compatible object storage

🌟 Features

  • Direct integration with MinIO object storage
  • Support for public and private buckets
  • Configurable CDN and upload options
  • Flexible file key and metadata generation
  • Environment variable-driven configuration

πŸ—οΈ Architecture Overview

graph TD
A[MedusaJS] -->|File Upload| B[MinIO Storage]
B -->|Public Files| C[CDN]
B -->|Private Files| D[Secure Bucket]
subgraph File Management
Upload[File Upload]
Download[Presigned URLs]
Metadata[Custom Metadata]
end

Key Capabilities

  • Self-hosted object storage
  • S3-compatible API
  • Secure file management
  • Flexible deployment options

πŸ“¦ Installation

Install the package using npm:

npm install @vymalo/medusa-minio

Or using yarn:

yarn add @vymalo/medusa-minio

πŸš€ Configuration

Plugin Setup

modules: [
{
resolve: '@medusajs/medusa/file',
options: {
providers: [
{
resolve: '@vymalo/medusa-minio',
id: 'minio',
options: {
endpoint: process.env.MINIO_ENDPOINT,
cdn_url: process.env.MINIO_CDN_URL,
bucket: process.env.MINIO_BUCKET,
private_bucket: process.env.MINIO_PRIVATE_BUCKET
|| process.env.MINIO_BUCKET,
access_key_id: process.env.MINIO_ACCESS_KEY,
secret_access_key: process.env.MINIO_SECRET_KEY,
},
},
],
},

πŸ”§ Advanced Configuration Options

interface MinioOptions {
// Required Basic Configuration
endpoint: string; // MinIO server endpoint
cdn_url: string; // CDN URL for public files
bucket: string; // Default public bucket
access_key_id: string; // MinIO access key
secret_access_key: string; // MinIO secret key
// Optional Advanced Settings
private_bucket?: string; // Separate private bucket
download_url_duration?: number; // Presigned download URL expiry
upload_url_duration?: number; // Presigned upload URL expiry
// Customization Hooks
uploadMetadata?: (file: ProviderUploadFileDTO | ProviderGetPresignedUploadUrlDTO) => ItemBucketMetadata; // Custom metadata generator
buildKey?: (file: ProviderUploadFileDTO | ProviderGetPresignedUploadUrlDTO) => string; // Custom file key generator
}

Customization Examples

Custom File Key Generation

buildKey: (file) => {
// Generate custom file path/key
return `uploads/${new Date().toISOString()}/${file.originalName}`;
}

Custom Metadata

uploadMetadata: (file) => ({
'x-amz-meta-my-key': 'custom-value',
'content-type': file.mimetype
})

🌐 Environment Variables

Required Environment Variables:

  • Copy to clipboardMINIO_ENDPOINT: MinIO server URL
  • Copy to clipboardMINIO_CDN_URL: CDN endpoint for public files
  • Copy to clipboardMINIO_BUCKET: Default public bucket name
  • Copy to clipboardMINIO_ACCESS_KEY: MinIO access key
  • Copy to clipboardMINIO_SECRET_KEY: MinIO secret key

Optional Environment Variables:

  • Copy to clipboardMINIO_PRIVATE_BUCKET: Separate private bucket name

πŸ›‘οΈ Security Considerations

  • Use strong, unique access keys
  • Implement bucket-level access controls
  • Rotate credentials regularly
  • Use HTTPS for all communications

🀝 Contributing

Contributions are welcome! Please submit pull requests or open issues.

πŸ“„ License

Check the license

You may also like

Browse all integrations

Build your own

Develop your own custom integration

Build your own integration with our API to speed up your processes. Make your integration available via npm for it to be shared in our Library with the broader Medusa community.

gift card interface

Ready to build your custom commerce setup?