A pnpm monorepo for developing a single reusable Nuxt layer with documentation and playground.
├── layer/ # The Nuxt layer package
├── playground/ # Development playground for testing the layer
├── docs/ # Documentation site (Nuxt Content)
├── pnpm-workspace.yaml # Workspace configuration
└── package.json # Root workspace config
-
Install dependencies
pnpm install
-
Start development playground
pnpm play:dev
-
View documentation
pnpm docs:dev
pnpm play:dev- Start the playground for layer developmentpnpm play:prepare- Prepare the playground (useful after layer changes)pnpm play:build- Build the playgroundpnpm play:generate- Generate static playgroundpnpm play:preview- Preview the built playground
pnpm docs:dev- Start the documentation sitepnpm docs:build- Build the documentationpnpm docs:generate- Generate static documentationpnpm docs:preview- Preview the built documentation
pnpm layer:build- Build the layerpnpm layer:generate- Generate static layerpnpm layer:preview- Preview the built layerpnpm layer:publish- Publish the layer to npm
pnpm test- Run tests (layer package)pnpm lint- Lint all packagespnpm type-check- Type check all packages
Located in layer/, this is your main Nuxt layer package.
Usage:
// nuxt.config.ts
export default defineNuxtConfig({
extends: "nuxt-email-layer",
});- Make changes to files in
layer/ - Test in the playground with
pnpm play:dev - Document changes in
docs/content/
The playground/ directory contains a Nuxt app that extends your layer:
# Start the playground
pnpm play:dev
# Build the playground
pnpm play:buildWhen ready to publish:
# Build and publish the layer
pnpm layer:publishThe documentation site is built with Nuxt Content and includes:
- Layer documentation and examples
- API references
- Usage guides
Visit the docs at http://localhost:3000 when running pnpm docs:dev.
- Node.js 18+
- pnpm 8+
- Nuxt 4+
- Components: Add reusable components in
layer/components/ - Configuration: Define layer config in
layer/app.config.ts - Composables: Add composables in
layer/composables/ - Plugins: Add plugins in
layer/plugins/ - Testing: Use the playground to test all functionality
The layer can be published to npm independently. Make sure to:
- Update the version in
layer/package.json - Test thoroughly in the playground
- Document changes in the docs
- Run
pnpm layer:publish