Setup

Having more secure Nuxt project is only one command away ✨


Installation

  1. Install nuxt-security module:
Yarn
yarn add --dev nuxt-security
NPM
npm install nuxt-security --save-dev
PNPM
pnpm add -D nuxt-security
  1. Enable the module in your Nuxt configuration:
nuxt.config.ts
export default defineNuxtConfig({  modules: ['nuxt-security']})
That's it! The Nuxt Security module will now register routeRoules and middlewares to make your application more secure ✨
You can find more about configuring nuxt-securityhere.

Static site generation (SSG)

This module is meant to work with SSR apps but you can also use this module in SSG apps where you will get a Content Security Policy (CSP) support.

You can find more about configuring Content Security Policy (CSP) here.