Getting Started

Here is a simple guide to setting up Nuxt File Storage in your project.

Play online

You can play with Nuxt File Storage in your browser using Stackblitz:

Play on StackBlitz

Add to your project

  1. Go to your project and type in:
bash
npx nuxi@latest module add nuxt-file-storage
  1. add nuxt-file-storage to your modules:
nuxt.config.ts
export default defineNuxtConfig({
    modules: ['nuxt-file-storage'],
})
  1. add the absolute mount location:
nuxt.config.ts
export default defineNuxtConfig({
    modules: ['nuxt-file-storage'],
    fileStorage: {
        mount: process.env.mount
    },
})
.env
mount='/home/$USR/development/your-nuxt-app/server/files'
You should definitely use Environment Variables .env instead of hard-coding your mount to differentiate between local development and deployment and to not expose your file system structure to your project.