Guards

The module provides two ways to protect routes from non-authenticated users :

Client middleware

If you want to protect your routes from client, add the guard middleware to your pages.

<script setup lang="ts">definePageMeta({  middleware: 'guard'})</script>

Server middleware

If you want to restric access from server, set guardSSR to true & list the route you want to protect in guardRoutes :

export default defineNuxtConfig({  appwrite: {    guardSSR: true    guardRoutes: ['/account', '/dashboard'],    guardRoutesRedirectURL: '/login',  }})
  • The server middleware affects nested routes too. In our cases, any route in /account or /dashboard will be protected by middleware too.