---
title: "Files"
description: "Let people upload photos and files: checked on the server, stripped of location data, counted against quotas, shown only to who may see them, shared by link and swept when nobody keeps them, on Convex file storage."
canonical_url: "https://nuxt-backend.dev/docs/build/data/files"
---
# Files

> Let people upload photos and files: checked on the server, stripped of location data, counted against quotas, shown only to who may see them, shared by link and swept when nobody keeps them, on Convex file storage.

Version: nuxt-backend 0.6.x · Tab: Build · Kind: landing · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

People upload photos, covers and attachments; your app keeps them, shows them and shares some of them. Convex file storage holds the bytes, mints upload URLs and serves file URLs. `setupStorage` adds the backend half in one call: the checks, the owner records, access, share links and cleanup. The base module's `useUpload` and `useUploadQueue`, and `<UploadField>` around the queue, do the browser half.

## How it works

```text
browser              your mutation                    backend component
photo bytes ───────▶ storage.store()   checked, stripped, stored with your row
large file ─▶ URL ─▶ storage.claim()   size and quota now; type and stripping next
                     storage.fileUrl() / signedUrl()  shown to who may see it
                     storage.shareable()              a link anyone holding it opens
                                                      sweep: unclaimed uploads, after a day
```

1. **Store or claim.** A photo goes to your mutation as bytes, and `storage.store` keeps it with your row in one transaction. A large file goes to an upload URL first, and your mutation claims its storage id.
2. **Check.** The size, the type read from the file's bytes, file and byte quotas, and EXIF and GPS data removed from images.
3. **Show.** A file reaches a page only through a check: its owner, a member of its workspace, or your own query that decided. An expiring URL serves a private file for a set time.
4. **Share.** A row you mark `shareable` gets a link its owner turns on, rotates and revokes, with a preview card and the sharer's referral code.
5. **Sweep.** An upload nobody claimed is deleted by the component's maintenance after a day.

## Who does what

<table>
<thead>
  <tr>
    <th>
      
    </th>
    
    <th>
      Convex
    </th>
    
    <th>
      The package
    </th>
    
    <th>
      Your app
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Storing bytes
    </td>
    
    <td>
      <a href="https://docs.convex.dev/file-storage" rel="nofollow">
        File storage
      </a>
      
      , upload URLs, <code>
        ctx.storage
      </code>
      
       in mutations
    </td>
    
    <td>
      Keeps files in the <code>
        backend
      </code>
      
       component's storage, beside their owner records
    </td>
    
    <td>
      Nothing
    </td>
  </tr>
  
  <tr>
    <td>
      Checking uploads
    </td>
    
    <td>
      The stored size and the declared type
    </td>
    
    <td>
      <code>
        maxSize
      </code>
      
      , <code>
        accept
      </code>
      
       on the sniffed type, <code>
        stripMetadata
      </code>
      
      , file and byte quotas
    </td>
    
    <td>
      The limits, and where each file is attached
    </td>
  </tr>
  
  <tr>
    <td>
      Access
    </td>
    
    <td>
      None: a file URL works for whoever holds it
    </td>
    
    <td>
      <code>
        getFileUrl
      </code>
      
       for the owner and their workspace; <code>
        signedUrl
      </code>
      
       that expires
    </td>
    
    <td>
      Which of your rows point at which file
    </td>
  </tr>
  
  <tr>
    <td>
      Images
    </td>
    
    <td>
      The original bytes
    </td>
    
    <td>
      An image provider for <code>
        @nuxt/image
      </code>
    </td>
    
    <td>
      Sizes and formats, in <code>
        <NuxtImg>
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Sharing
    </td>
    
    <td>
      None
    </td>
    
    <td>
      Hashed share links, <code>
        useShareLink
      </code>
      
      , preview cards, the share loop
    </td>
    
    <td>
      Which tables are shareable, and the public page
    </td>
  </tr>
  
  <tr>
    <td>
      Cleanup
    </td>
    
    <td>
      None
    </td>
    
    <td>
      Owner records, <code>
        release
      </code>
      
      , the orphan sweep, export and erasure
    </td>
    
    <td>
      When your rows let go of a file
    </td>
  </tr>
</tbody>
</table>

## In development and in production

Files live on the deployment you run: your dev deployment while you build, the production one once you ship. There is no provider key: the `data` capability reads `test` on a dev deployment and `live` on production ([Capabilities](https://nuxt-backend.dev/docs/start/concepts/capabilities)). Storage and bandwidth count against your Convex plan ([Convex](https://nuxt-backend.dev/docs/services/convex)). A person's files join their [data export](https://nuxt-backend.dev/docs/build/auth/accounts/data), and their account's erasure deletes them.

## In this section

<card-group>
<card icon="i-lucide-file-check" title="Accept checked uploads" to="https://nuxt-backend.dev/docs/build/data/files/checked-uploads">

`setupStorage`, a photo stored with its row in one mutation, upload URLs and `<UploadField>` for large files.

</card>

<card icon="i-lucide-image" title="Show images" to="https://nuxt-backend.dev/docs/build/data/files/images">

`<StorageImage>`, the image provider for `<NuxtImg>`, and expiring private URLs.

</card>

<card icon="i-lucide-link" title="Share by link" to="https://nuxt-backend.dev/docs/build/data/files/share-links">

A link to one row, its public page, a preview card and the share loop.

</card>

<card icon="i-lucide-trash-2" title="Keep storage clean" to="https://nuxt-backend.dev/docs/build/data/files/cleanup">

Release files with their rows, the orphan sweep, and files in export and erasure.

</card>
</card-group>

## Not included

- **Moderation.** What an image shows is content safety: [Keep content safe](https://nuxt-backend.dev/docs/build/ai/content-safety).
- **Image transforms in storage.** Convex serves original bytes; resizing comes from your host's optimizer through the [image provider](https://nuxt-backend.dev/docs/build/data/files/images#resize-with-the-image-provider).
- **Video processing.** No transcoding or streaming formats: store video as a download, or use a video service.


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
