Nuxt Essentials (Part 2): Middleware, Plugins, and Layers
Nuxt gives you middleware (route and server), plugins (client, server, or both), and layers. Each has a different job: middleware runs around navigation or requests; plugins run once at app init to set up state or libraries; layers let you reuse and compose whole Nuxt apps. This post explains when to use which and how to keep them clear.
Route middleware (client)
Route middleware runs in the browser during navigation. It receives the target route and can redirect, abort, or allow the navigation. Use it for: