Skip to content

nuxt-feathers-zodFeathersJS v5 + Zod + Nuxt 4 (Nitro)

Two modes: embedded Feathers backend inside Nuxt (Nitro) OR a remote Feathers client. Zod-first generation, Pinia client, Swagger (legacy), and optional Keycloak SSO.

Feather logo

Quickstart

Embedded (local Feathers server)

bash
bunx nuxt-feathers-zod init embedded --force
bun dev

Remote (Socket.IO first)

bash
bunx nuxt-feathers-zod init remote --url https://api.example --force
bun dev

Remote mode

In remote mode, NFZ behaves as a Feathers client (REST or Socket.IO). It does not scan local services and does not require an embedded users/authentication service.

Notes

  • For embedded services, set feathers.servicesDirs = ['services'].
  • Always generate services via the CLI: bunx nuxt-feathers-zod add service ....
  • To enable remote mode: bunx nuxt-feathers-zod init remote --url http://... (Socket.IO by default, REST via --transport rest).
  • In remote mode, feathers.templates.dirs is optional (only needed if you want to override client templates).

Authentication (embedded + remote)

The module supports Feathers v5 (Dove) auth in both modes:

  • JWT (strategy: 'jwt') via @feathersjs/authentication
  • Local (strategy: 'local') via @feathersjs/authentication-local
  • OAuth (strategy: 'oauth') via @feathersjs/authentication-oauth
  • Keycloak SSO remains an optional authentication mode

In remote mode, the module does not require local schemas (services/**) to boot. entityImport is optional.

Secure defaults (embedded / Express)

In embedded mode, the REST server (Express) can enable a “secure defaults” preset:

  • CORS (ON by default)
  • compression
  • helmet
  • json + urlencoded body parsing
  • optional static serving
ts
export default defineNuxtConfig({
  feathers: {
    server: {
      secureDefaults: true,
      secure: {
        cors: true,
        helmet: true,
        compression: true,
        serveStatic: { path: '/', dir: 'public' } // or false
      }
    }
  }
})

nuxt-feathers-zod module documentation