Upload, store, and serve files with a consistent API. Supports cloud object storage, Cloudflare R2, and local filesystem for development.
Scalable object storage with global CDN and lifecycle policies
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYS3_BUCKETS3-compatible object storage with zero egress fees
R2_ACCOUNT_IDR2_ACCESS_KEY_IDR2_SECRET_ACCESS_KEYR2_BUCKETLocal file storage for development and testing
Upload a file
Store a file using the unified storage API
import { storage } from '@/lib/storage'
const url = await storage.upload('avatars/user-123.png', file, {
contentType: 'image/png',
public: true,
})Add storage to your Primstack project with a single command:
prim storage init