nuxt-osdd brings Open Source Driven Development to Nuxt. Organize your application into independent, composable layers — each layer with its own components, composables, pages, and configuration.
OSDD separates your application into two top-level buckets, keeping business logic and infrastructure concerns cleanly apart.
Domain layers that represent business concerns — functional/users, functional/orders, functional/billing. Each owns its own components, pages, composables, and assets.
Infrastructure layers shared across the application — authentication adapters, API clients, database configuration. Keeps cross-cutting concerns in one place.
Add new layers without touching existing ones. The architecture scales naturally from a small app to a large monorepo — no big-bang refactors required.
OSDD replaces Nuxt's default layers approach which adds unnecessary depth to your project structure.
Without OSDD (Nuxt default):
/layers/functional/<functionalLayer>/nuxt.config.ts
With OSDD:
/functional/<functionalLayer>/nuxt.config.ts
/technical/<technicalLayer>/nuxt.config.ts
Your layers are directly at the project root, making your codebase flatter and easier to navigate.
npm install nuxt-osddEasily create functional or technical layers with pre-configured templates.
npx nuxt-osdd osdd:layer <layer-name> [--technical|--functional]
# Examples - Technical layers (infrastructure)
npx nuxt-osdd osdd:layer Authentication --technical
npx nuxt-osdd osdd:layer Database --technical
# Examples - Functional layers (business)
npx nuxt-osdd osdd:layer Contracts --functional
npx nuxt-osdd osdd:layer Posts --functional
# Interactive mode
npx nuxt-osdd osdd:layer
# Display help
npx nuxt-osdd --helpThe script will automatically create:
- A folder in
functional/ortechnical/at the project root - A basic
nuxt.config.tsfile - A
README.mdfile to document the layer
Wrap your nuxt.config.ts with defineOSDDNuxtConfig to declare OSDD layers. The osdd config key drives both extends and typescript.tsConfig automatically.
// nuxt.config.ts
import { defineOSDDNuxtConfig } from 'nuxt-osdd';
export default defineOSDDNuxtConfig({
osdd: {
technical: ['Authentication', 'Permission'], // Technical needs
functional: ['Contracts', 'Posts'], // Business needs
}
});Migrating your existing Nuxt application to OSDD is straightforward:
- Update your main
nuxt.config.ts— simply replacedefineNuxtConfigwithdefineOSDDNuxtConfig:
// Before
import { defineNuxtConfig } from 'nuxt/config';
export default defineNuxtConfig({
// your config
});
// After
import { defineOSDDNuxtConfig } from 'nuxt-osdd';
export default defineOSDDNuxtConfig({
osdd: {
technical: ['Authentication', 'Database'],
functional: ['Users', 'Orders'],
},
// your config
});- Create your layers using the CLI command:
# Create technical layers
npx nuxt-osdd osdd:layer Authentication --technical
npx nuxt-osdd osdd:layer Database --technical
# Create functional layers
npx nuxt-osdd osdd:layer Users --functional
npx nuxt-osdd osdd:layer Orders --functional- Move your code into the appropriate layers (
functional/ortechnical/)
That's it! Your application is now organized with OSDD.
Disclaimer: If you don't use Nuxt's auto-import feature, you may need to update your import paths.
// Import from a functional layer
import { UserService } from '~/functional/Users/services/UserService';
// Import from a technical layer
import { AuthAdapter } from '~/technical/Authentication/adapters/AuthAdapter';ISC