Note: This is a starter template. Once the project is initialized with your module name and configuration, this file should be updated or replaced with project-specific instructions.
This is a Nuxt Module Starter — a monorepo template for creating Nuxt modules with:
- A publishable Nuxt module (
packages/my-module) - A playground app for development (
apps/playground) - A Docus-powered documentation site (
apps/docs) - GitHub workflows for CI, releases, and PR previews
- Automd for automated README snippets
When starting a new project from this starter, the following must be replaced:
Replace all occurrences of the following placeholders:
| Placeholder | Replace With | Example |
|---|---|---|
my-module |
Your package name (kebab-case) | nuxt-icon |
My Module |
Your module display name | Nuxt Icon |
myModule |
Your module config key (camelCase) | nuxtIcon |
your-org/your-module |
Your GitHub repository | nuxt/icon |
My new Nuxt module |
Your module description | Icon module for Nuxt |
example.com |
Your documentation URL | nuxt-icon.nuxt.dev |
@YourName |
Your GitHub handle | @HugoRCD |
packages/my-module/ → packages/<your-module>/
apps/playground/ (update nuxt.config.ts module reference)
apps/docs/ (update package.json name)
| File | What to Update |
|---|---|
package.json (root) |
name, repository.url, script filters |
packages/my-module/package.json |
name, description, repository.url |
packages/my-module/src/module.ts |
meta.name, meta.configKey, meta.docs |
apps/playground/nuxt.config.ts |
Module import and config key |
apps/docs/package.json |
name |
README.md |
Module name, description, badges |
.github/snippets/*.md |
Feature descriptions, URLs |
apps/docs/content/ |
Documentation content |
LICENSE |
Author name (if needed) |
After initialization, check for outdated dependencies:
# Check outdated packages
bun outdated
# Update all dependencies (interactive)
bunx npm-check-updates -i
# Or update directly
bunx npm-check-updates -u && bun installKey dependencies to keep current:
nuxtand@nuxt/*packages@nuxt/kit,@nuxt/schema,@nuxt/module-builderdocus(for docs)turbo,vitest,eslint
├── apps/
│ ├── playground/ # Dev environment for testing the module
│ │ ├── app.vue # Test your module features here
│ │ └── nuxt.config.ts # Module is imported here
│ └── docs/ # Docus documentation site
│ ├── content/ # Markdown documentation pages
│ └── public/ # Static assets
├── packages/
│ └── my-module/ # The publishable Nuxt module
│ ├── src/
│ │ ├── module.ts # Module definition (main entry)
│ │ └── runtime/ # Runtime code (plugins, composables, components)
│ └── test/ # Module tests
├── .github/
│ ├── workflows/ # CI, release, PR preview workflows
│ └── snippets/ # Automd README snippets
├── turbo.json # Turborepo configuration
└── package.json # Root workspace configuration
# Install dependencies
bun install
# Prepare module for development (generates types)
bun run dev:prepare
# Start playground (for module development)
bun run dev
# Start documentation site
bun run docs
# Build module
bun run build:module
# Build documentation
bun run build:docs
# Run all tests
bun run test
# Lint all packages
bun run lint
bun run lint:fix
# Type check all packages
bun run typecheck
# Update README with automd snippets
bun run automd- Develop the module in
packages/my-module/src/ - Test features in
apps/playground/app.vue - Write tests in
packages/my-module/test/ - Document in
apps/docs/content/ - Update README snippets in
.github/snippets/
// packages/my-module/src/runtime/composables/useMyFeature.ts
export function useMyFeature() {
return { /* ... */ }
}
// packages/my-module/src/module.ts
addImports({
name: 'useMyFeature',
from: resolver.resolve('./runtime/composables/useMyFeature')
})// packages/my-module/src/module.ts
addComponent({
name: 'MyComponent',
filePath: resolver.resolve('./runtime/components/MyComponent.vue')
})// packages/my-module/src/module.ts
export interface ModuleOptions {
enabled: boolean
prefix: string
}
export default defineNuxtModule<ModuleOptions>({
defaults: {
enabled: true,
prefix: 'My'
},
setup(options, nuxt) {
// Access options.enabled, options.prefix
}
})The module uses changelogen for changelog generation and versioning:
# From packages/my-module
bun run releaseThis will:
- Run lint and tests
- Build the module
- Generate changelog
- Publish to npm
- Push git tags
- CI (
ci.yml): Runs on push/PR to main — build, lint, typecheck, test - Release (
release.yml): Automated releases via changelogen - PR Preview (
publishjob inci.yml): Creates npm preview packages for PRs
Use Nuxt UI components and semantic colors:
<!-- Use components -->
<UButton>Click</UButton>
<UInput v-model="value" />
<!-- Use semantic colors -->
<div class="bg-muted text-highlighted">
<div class="border-default">Nuxt auto-imports from standard directories — no manual imports needed for:
- Composables from
composables/ - Components from
components/ - Utils from
utils/
- Files: kebab-case (
my-composable.ts) - Vue components: PascalCase (
MyComponent.vue) - Directories: kebab-case
Once your module is set up:
- Update this file with your module-specific instructions, or
- Delete this file if not needed for your workflow
Consider keeping sections relevant to your module:
- Project-specific commands
- Architecture overview
- Development guidelines
- Testing instructions