nuxt-config
Nuxt and app configuration files. Use when configuring nuxt.config.ts, app.config.ts, environment variables, runtime config, or understanding how configuration flows through the application.
When & Why to Use This Skill
This Claude skill streamlines the configuration and architectural setup of Nuxt.js applications. It provides expert guidance on managing nuxt.config.ts, app.config.ts, and environment variables, ensuring developers can efficiently handle runtime configurations, module integrations, and multi-layer project structures. By automating the complexities of framework-specific settings, it helps maintain a scalable and error-free development environment.
Use Cases
- Core Framework Configuration: Assistance in setting up SSR/SPA modes, managing Nuxt modules (like Auth or UI), and configuring directory structures and path aliases.
- Environment & Runtime Management: Expertly mapping environment variables to runtime configurations (public and private) to ensure secure and flexible API integrations across different deployment stages.
- Advanced App Logic Setup: Defining global repositories, request/response interceptors, and centralized error handling within app.config.ts for a cleaner and more maintainable codebase.
- Layered Architecture Support: Configuring and understanding how configuration flows through extended Nuxt layers to facilitate modular and reusable application components.
| name | nuxt-config |
|---|---|
| description | Nuxt and app configuration files. Use when configuring nuxt.config.ts, app.config.ts, environment variables, runtime config, or understanding how configuration flows through the application. |
Nuxt Configuration
Application configuration via nuxt.config.ts and app.config.ts.
Core Concepts
config.md - Complete configuration patterns
nuxt.config.ts
export default defineNuxtConfig({
ssr: false, // SPA mode
extends: [
'../../../nuxt-layers/base',
'../../../nuxt-layers/nuxt-ui',
'../../../nuxt-layers/x-ui',
],
modules: ['nuxt-auth-sanctum', '@nuxt/ui'],
components: [{ path: 'components', pathPrefix: false }],
sanctum: {
baseUrl: process.env.NUXT_PUBLIC_API_URL,
endpoints: { login: '/auth/login', user: '/auth/user' },
},
runtimeConfig: {
public: {
apiUrl: undefined, // Set via NUXT_PUBLIC_API_URL
},
},
})
app.config.ts
export default defineAppConfig({
repositories: {
leads: LeadRepository,
contacts: ContactRepository,
},
interceptors: {
request: [appendSource],
response: [errorHandler],
},
errorHandlers: {
401: async ({ flash }) => navigateTo('/auth/login'),
422: async ({ response }) => new ValidationError(response),
},
})
Environment Variables
NUXT_PUBLIC_API_URL=https://api.example.com
NUXT_PUBLIC_REPOSITORIES_LEADS_FETCH_OPTIONS_BASE_URL=https://leads-api.example.com