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
- Log into your DigitalOcean account.
- Go to Spaces Object Storage and create a new bucket.
- Enable the CDN endpoint for the bucket.
- Set the bucket permissions to allow public read access for media files.
Generate Access Keys
- Navigate to API → Spaces Keys.
- Click Generate New Key.
- 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-keyFile Organization
Uploaded files are organized into subfolders within your DO_SPACES_FOLDER:
products/— product imagesposts/— blog post imagesusers/— user avatar imagescategories/— 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.mjsThis 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.