Local Development
This page covers the tools and workflows you’ll use day-to-day while building on NuxtBase.
Dev Server
Section titled “Dev Server”pnpm devnpm run devyarn devThe Nuxt dev server starts at http://localhost:3000 with HMR enabled. Changes to pages, components, composables, and server routes are reflected immediately.
Common Scripts
Section titled “Common Scripts”| Script | What it does |
|---|---|
pnpm dev / npm run dev / yarn dev | Start development server |
pnpm build / npm run build / yarn build | Build for production |
pnpm preview / npm run preview / yarn preview | Preview production build locally |
pnpm db:generate / npm run db:generate / yarn db:generate | Generate a new Drizzle migration |
pnpm db:migrate / npm run db:migrate / yarn db:migrate | Apply pending migrations |
pnpm db:studio / npm run db:studio / yarn db:studio | Open Drizzle Studio (browser UI) |
pnpm email:debug / npm run email:debug / yarn email:debug | Render or send a debug email |
pnpm admin:grant-platform-admin / npm run admin:grant-platform-admin / yarn admin:grant-platform-admin | Grant admin role to a user |
pnpm lint / npm run lint / yarn lint | Run ESLint |
pnpm lint:fix / npm run lint:fix / yarn lint:fix | Auto-fix ESLint issues |
pnpm format / npm run format / yarn format | Format with Prettier |
pnpm format:check / npm run format:check / yarn format:check | Check formatting only |
pnpm typecheck / npm run typecheck / yarn typecheck | Run Nuxt TypeScript checker |
pnpm test / npm run test / yarn test | Run Vitest unit tests |
pnpm test:watch / npm run test:watch / yarn test:watch | Run Vitest in watch mode |
pnpm test:e2e / npm run test:e2e / yarn test:e2e | Run Playwright E2E tests |
See package.json for the full list of scripts.
Email Testing
Section titled “Email Testing”NuxtBase supports three email drivers, controlled by NUXT_MAIL_DRIVER:
Preview (Default)
Section titled “Preview (Default)”NUXT_MAIL_DRIVER=previewEmails are rendered as HTML and saved to .tmp/email-previews/. No SMTP server needed. Open the HTML files in your browser to review.
Mailpit (Recommended for Local)
Section titled “Mailpit (Recommended for Local)”Mailpit is a local SMTP server with a web UI — the best option for testing email delivery locally.
docker run -d --name mailpit -p 8025:8025 -p 1025:1025 axllent/mailpitbrew install mailpitmailpitThen set in .env:
NUXT_MAIL_DRIVER=smtpNUXT_SMTP_HOST=127.0.0.1NUXT_SMTP_PORT=1025NUXT_SMTP_SECURE=falseView emails at http://localhost:8025.
Debug Email Script
Section titled “Debug Email Script”Render a specific email template without triggering the actual flow:
# Render to preview filepnpm email:debug -- --template verify-email
# Send to a real address via the configured driverpnpm email:debug -- --template verify-email --send --to you@example.com# Render to preview filenpm run email:debug -- --template verify-email
# Send to a real address via the configured drivernpm run email:debug -- --template verify-email --send --to you@example.com# Render to preview fileyarn email:debug --template verify-email
# Send to a real address via the configured driveryarn email:debug --template verify-email --send --to you@example.comAvailable templates: verify-email, reset-password, organization-invitation, subscription-change, credits-alert, magic-link.
Stripe CLI (Webhook Testing)
Section titled “Stripe CLI (Webhook Testing)”To test Stripe webhooks locally, install the Stripe CLI and forward events to your dev server:
stripe listen --forward-to localhost:3000/api/billing/webhookThe CLI prints a webhook signing secret (whsec_...). Set it in .env:
NUXT_STRIPE_WEBHOOK_SECRET=whsec_...Database Workflow
Section titled “Database Workflow”When you change a Drizzle schema file in server/database/schema/:
# 1. Generate a migration from your schema changespnpm db:generate
# 2. Apply the migrationpnpm db:migrate# 1. Generate a migration from your schema changesnpm run db:generate
# 2. Apply the migrationnpm run db:migrate# 1. Generate a migration from your schema changesyarn db:generate
# 2. Apply the migrationyarn db:migrateTo browse your database:
pnpm db:studionpm run db:studioyarn db:studioThis opens Drizzle Studio at https://local.drizzle.studio.
Code Quality
Section titled “Code Quality”The project uses Husky hooks for local quality gates.
- on
git commit, Husky runslint-staged - on
git push, Husky runs the unit test script with a dot reporter
That means pushes to your remote can be blocked until the unit test suite passes.
To run checks manually:
pnpm lint # check for issuespnpm lint:fix # auto-fixpnpm format # format all filespnpm typecheck # TypeScript checksnpm run lint # check for issuesnpm run lint:fix # auto-fixnpm run format # format all filesnpm run typecheck # TypeScript checksyarn lint # check for issuesyarn lint:fix # auto-fixyarn format # format all filesyarn typecheck # TypeScript checksProject Structure
Section titled “Project Structure”├── app/ # Nuxt frontend (pages, components, composables, layouts)├── server/ # Backend (API routes, services, database, utils)│ ├── api/ # Nitro route handlers│ ├── services/ # Provider abstractions (Billing, Mailer, Storage, AI)│ ├── database/schema/ # Drizzle ORM schema definitions│ └── utils/ # Domain logic and helpers├── shared/ # Shared code (validation schemas, config)├── content/ # Nuxt Content markdown (in-app docs)└── public/ # Static assets