OpenSky-commerce / Documentation

Media Storage (DigitalOcean Spaces)

All media uploads — product images, blog post images, user avatars — are stored in DigitalOcean Spaces and served via CDN. Spaces uses the S3-compatible API, so it also works with any S3-compatible object store (AWS S3, Cloudflare R2, MinIO, etc.).

Create a Spaces Bucket

  1. Log into your DigitalOcean account.
  2. Go to Spaces Object Storage and create a new bucket.
  3. Enable the CDN endpoint for the bucket.
  4. Set the bucket permissions to allow public read access for media files.

Generate Access Keys

  1. Navigate to API → Spaces Keys.
  2. Click Generate New Key.
  3. Copy the Access Key and Secret Key — the secret is only shown once.

Environment Variables

DO_SPACES_ENDPOINT=https://sfo3.digitaloceanspaces.com
DO_SPACES_CDN_ENDPOINT=https://your-bucket.sfo3.cdn.digitaloceanspaces.com
DO_SPACES_REGION=sfo3
DO_SPACES_BUCKET=your-bucket-name
DO_SPACES_FOLDER=your-app-folder
DO_SPACES_KEY=your-access-key
DO_SPACES_SECRET=your-secret-key

File Organization

Uploaded files are organized into subfolders within your DO_SPACES_FOLDER:

  • products/ — product images
  • posts/ — blog post images
  • users/ — user avatar images
  • categories/ — category images

Copying Seed Images

A utility script is included to copy the demo seed images to your Spaces bucket:

node scripts/copy-spaces-folder.mjs

This copies the sample images from public/images/ to your configured Spaces bucket. Run this after setting up your environment variables and before importing demo data.

Using a Different S3-Compatible Provider

Set DO_SPACES_ENDPOINT to your provider's endpoint URL and update the region accordingly. The upload logic in src/lib/digitalOceanUpload.ts uses the AWS SDK S3-compatible client and works with any compatible provider.