Prerequisites
Before you begin, ensure you have the following installed:- Node.js: Version 18 or higher recommended
- npm: Comes with Node.js (or use yarn/pnpm)
- Git: For version control
Initial Setup
Install dependencies
Install all required dependencies:This will also set up Husky hooks for commit linting and code quality checks.
Available Scripts
The project includes several npm scripts for different development tasks:Development
Storybook
Production Build
Code Quality
Development Workflow
Adding a New Component
Project Structure
Configuration Files
Nuxt Configuration
Thenuxt.config.ts file configures the layer:
nuxt.config.ts
Package Configuration
Key fields inpackage.json:
Git Workflow
This project uses Conventional Commits and Semantic Release for versioning.Commit Message Format
Use the Commitizen CLI for properly formatted commits:feat:New featuresfix:Bug fixesdocs:Documentation changesstyle:Code style changes (formatting, etc.)refactor:Code refactoringtest:Adding or updating testschore:Maintenance tasks
Example Commits
Code Quality Tools
The project includes several tools to maintain code quality:Husky
Git hooks for pre-commit and commit-msg validation
Commitlint
Ensures commit messages follow conventional commits
Prettier
Code formatting with Tailwind CSS plugin
Semantic Release
Automated versioning and changelog generation
Testing Components
In Storybook
- Start Storybook:
npm run storybook - Navigate to your component
- Test different props and variants
- Check responsive behavior
- Verify accessibility
In Nuxt Dev Server
- Start dev server:
npm run dev - Create or modify a page to use your component
- Test in the full Nuxt context
- Verify SSR behavior
Building for Production
Publishing
The automated release process:- Analyzes commit messages
- Determines version bump (major, minor, patch)
- Generates changelog
- Publishes to npm
- Creates GitHub release
Key Dependencies
Production Dependencies
- @nuxt/ui: Nuxt UI component library
- tailwindcss: Utility-first CSS framework
- @tailwindcss/vite: Vite plugin for Tailwind
- nuxt: Nuxt 4 framework
Development Dependencies
- @nuxtjs/storybook: Storybook integration for Nuxt
- @chromatic-com/storybook: Visual testing
- prettier: Code formatting
- commitizen: Conventional commits CLI
Environment Variables
STORYBOOK
TheSTORYBOOK environment variable controls whether the Storybook module is loaded:
Troubleshooting
Module not found errors
Module not found errors
Try removing
node_modules and reinstalling:Storybook not loading
Storybook not loading
Ensure the
STORYBOOK environment variable is set:Tailwind styles not applying
Tailwind styles not applying
Check that the Vite Tailwind plugin is configured in
nuxt.config.ts and the CSS file is imported.Next Steps
- Learn about using this as a Nuxt Layer in your projects
- Explore components in Storybook
- Check the Component Overview