Skip to content

Archetipo95/my-nuxt-starter

Repository files navigation

πŸš€ Martin's Nuxt Starter

A modern, full-featured Nuxt 4 starter template with TypeScript, Tailwind CSS, and everything you need to build amazing web applications.

Nuxt TypeScript Tailwind CSS pnpm Lint and Typecheck Unit Tests

🌐 Live Demo β€’ πŸ“– Documentation β€’ πŸš€ Quick Start


✨ Features

🎯 Core Technologies

  • πŸ”₯ Nuxt 4 - The latest version of the Vue.js framework
  • πŸ“˜ TypeScript - Full type safety with vue-tsc
  • 🍹 Pinia Colada - Async state management & data fetching
  • πŸš€ pnpm - Fast, disk space efficient package manager
  • 🎨 Tailwind CSS v4 - Modern utility-first CSS framework
  • ⚑ Vite - Lightning fast build tool
  • 🌍 Internationalization - i18n support with @nuxtjs/i18n

🧩 UI & Components

  • 🎨 Nuxt UI v4 - Beautiful, accessible components
  • πŸŒ™ Color Mode - Dark/light theme support
  • πŸ–ΌοΈ Icons - Comprehensive icon system (@nuxt/icon)
  • πŸ”€ Fonts - Web font optimization (@nuxt/fonts)
  • πŸ–ΌοΈ Images - Advanced image optimization (nuxt-image)
  • πŸ“± Modals & Toasts - Ready-to-use overlay components

πŸ”§ Developer Experience

  • πŸ“‹ ESLint v9 - Code linting with @nuxt/eslint & @antfu/eslint-config
  • πŸ”„ VueUse v13 - Essential Vue composition utilities
  • πŸ“š Storybook - Component development and documentation
  • πŸ§ͺ Vitest - Fast unit testing with coverage
  • 🎭 Playwright - End-to-end testing
  • πŸ”’ Security - Built-in security headers (nuxt-security)

πŸš€ CI/CD & Quality

  • πŸ“ Commitlint - Conventional commit messages
  • πŸͺ Git Hooks - Pre-commit validation
  • πŸ” Lint Staged - Lint only changed files
  • βš™οΈ GitHub Actions - Automated testing and deployment

πŸš€ Quick Start

Prerequisites

  • Node.js (see .nvmrc for version) - Use NVM for version management
  • pnpm - Install globally: npm install -g pnpm

Installation

# Use the correct Node version
nvm use

# Install dependencies
pnpm install

# Start development server
pnpm dev

Available Scripts

Command Description
pnpm dev πŸš€ Start development server
pnpm build πŸ—οΈ Build for production
pnpm generate πŸ“¦ Generate static site
pnpm preview πŸ‘οΈ Preview production build
pnpm test:unit πŸ§ͺ Run unit tests
pnpm test:unit-coverage πŸ“Š Run unit tests with coverage
pnpm test:unit-ui πŸ–₯️ Run unit tests with UI
pnpm test:e2e 🎭 Run E2E tests
pnpm test:e2e-ui πŸ–₯️ Run E2E tests with UI
pnpm test:codegen 🎬 Generate E2E tests
pnpm lint πŸ” Lint code
pnpm lint:fix πŸ”§ Lint and fix code
pnpm typecheck πŸ“˜ Type checking

πŸ“ Project Structure

my-nuxt-starter/
β”œβ”€β”€ πŸ“ app/                    # Main application
β”‚   └── πŸ“ assets/             # Static assets
β”‚   β”œβ”€β”€ πŸ“ components/         # Vue components
β”‚   β”œβ”€β”€ πŸ“ composables/        # Vue composables
β”‚   β”œβ”€β”€ πŸ“ layouts/            # Layout components
β”‚   β”œβ”€β”€ πŸ“ pages/              # Page components
β”œβ”€β”€ πŸ“ tests/                  # Test files
β”‚   └── πŸ“ e2e/                # End-to-end tests
β”œβ”€β”€ πŸ“ server/                 # Server-side code
β”œβ”€β”€ πŸ“ public/                 # Public static files
└── πŸ“„ nuxt.config.ts          # Nuxt configuration

🍹 Data Fetching (Pinia Colada)

This project uses Pinia Colada for async state management. It provides caching, deduplication, and invalidation out of the box.

Basic Usage

Use useQuery to fetch data:

<script setup lang="ts">
const { state, asyncStatus } = useQuery({
  key: ['products'],
  query: () => fetch('/api/products').then(r => r.json())
})
</script>

<template>
  <div v-if="asyncStatus === 'loading'">Loading...</div>
  <div v-else-if="state.error">Error: {{ state.error }}</div>
  <div v-else>
    {{ state.data }}
  </div>
</template>

Mutations

Use useMutation to modify data:

<script setup lang="ts">
const { mutate } = useMutation({
  mutation: (newProduct) => fetch('/api/products', {
    method: 'POST',
    body: JSON.stringify(newProduct)
  })
})
</script>

For more details, check the Pinia Colada documentation.


πŸ’» Development

Commit Guidelines

Follow the Conventional Commits specification:

<type>: <description>

Types: feat, fix, docs, style, refactor, test, chore, ci, build, perf, revert

Examples:

  • feat: add user authentication
  • fix: resolve navbar responsive issue
  • docs: update installation guide

Unit Test

# Run unit tests
pnpm test:unit

# Run unit tests with coverage
pnpm test:unit-coverage

# Run unit tests with ui
pnpm test:unit-ui

E2E Test

# Install Playwright browsers (required for E2E tests)
pnpm exec playwright install

# Run E2E tests
pnpm test:e2e

# Run E2E tests with ui
pnpm test:e2e-ui

# Run codegen for E2E tests
pnpm test:codegen

πŸ€– Testing GitHub Actions Locally

We suggest using act to try GitHub Actions locally before pushing to GitHub. This allows you to validate your workflows and save time by running them in a local containerized environment.

πŸ“‹ Roadmap

πŸ”„ In Progress

  • 🎨 Custom Icon Library - Project-specific icons
  • πŸ“Š Coverage GitHub Action - Automated coverage reports

🎯 Planned Features

  • πŸ” Zod - Runtime type validation
  • 🎨 Chromatic - Visual testing
  • 🚦 Lighthouse - Performance monitoring

πŸ› οΈ Troubleshooting

Having issues? Try these steps:

  1. 🧹 Clean the project: pnpm clean-project
  2. πŸ“‹ Check Node version: Ensure you're using the version specified in .nvmrc
  3. πŸ“¦ Check pnpm version: Verify it matches the version in package.json
  4. πŸ”„ Reinstall dependencies: rm -rf node_modules && pnpm install
  5. πŸ”§ Check environment: Ensure all required environment variables are set

🀝 Contributing

We welcome contributions! Please read our Contributing Guidelines before submitting a pull request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feat/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feat/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License.


πŸ™ Acknowledgments

Built with ❀️ using amazing open-source projects:


⚠️ Tailwind CSS Linting (Beta)

Please note that ESLint support for Tailwind CSS is currently in beta due to the ongoing development of Tailwind CSS v4. If you encounter any issues or false positives, you can disable this feature by modifying the eslint.config.mjs file or temporarily disabling the specific rules.


🌟 Star this repository if you find it helpful!

About

Nuxt 4 template ready to be used with integrations like Storybook, Tailwind, Vueuse, and many more!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

 
 
 

Contributors