Using appropriate middleware and plugins can make the code cleaner.
Plugins (server) → app.vue → Middleware → Page Components
↓
Plugins (client)
• Run first, before everything else
• Used for app-wide setup and initialization
• Can run on server-side, client-side, or both
• Perfect for:
▪ Setting up external libraries
▪ Initial auth state setup
▪ Global API configurations
▪ Adding global utilities/composables
• The main entry point of your application
• Runs after plugins but before middleware
• Controls the global layout structure
• Best for:
▪ Global layout management