Storage Technical Details

This document provides technical details about the Storage feature, primarily for developers or for advanced configuration after deployment.

Configuration

The storage module is configured in nuxt.config.ts and supports multiple drivers (Local, R2, S3).

Example configuration:

export default defineNuxtConfig({
  storageModule: {
    driver: 'r2', // Options: 'local', 'r2', 's3'
    r2: {
      publicBucketBinding: 'R2_PUBLIC',
      privateBucketBinding: 'R2_PRIVATE',
      publicDomain: 'https://pub-your-domain.com',
    },
    limits: {
      maxFileSize: 10 * 1024 * 1024, // 10MB limit
      allowedMimeTypes: ['image/jpeg', 'image/png', 'application/pdf'],
    },
  },
})

Programmatic Usage

Files can be managed programmatically using the useStorage composable.

Example upload:

<script setup>
const { upload } = useStorage()

async function handleUpload(file) {
  const { url } = await upload(file, {
    bucket: 'public', // or 'private'
  })
  console.log('File uploaded:', url)
}
</script>

Admin Capabilities

The module includes an admin interface configured via useStorageAdmin. Capabilities include:

  • File Manager: Browse and manage bucket contents.
  • Uploader: Interface for uploading files.
  • Stats: View storage usage metrics.

Need a Landing Page?

Modern landing pages with optional modules (blog, docs, forms, i18n). Let's discuss your project.

Build Your MVP

Full-stack SaaS development. Expert in database design, multi-tenancy, and scalable architecture.

Deployment Help

Dockerize your backend, set up CI/CD pipelines, deploy to Cloudflare or Hetzner. Early-stage setup.

Suggest a SaaS Tool

Missing a calculator or tool? Suggest what you'd like to see on our site.