Skip to content

Local Development

This page covers the tools and workflows you’ll use day-to-day while building on NuxtBase.

Terminal window
pnpm dev

The Nuxt dev server starts at http://localhost:3000 with HMR enabled. Changes to pages, components, composables, and server routes are reflected immediately.

ScriptWhat it does
pnpm dev / npm run dev / yarn devStart development server
pnpm build / npm run build / yarn buildBuild for production
pnpm preview / npm run preview / yarn previewPreview production build locally
pnpm db:generate / npm run db:generate / yarn db:generateGenerate a new Drizzle migration
pnpm db:migrate / npm run db:migrate / yarn db:migrateApply pending migrations
pnpm db:studio / npm run db:studio / yarn db:studioOpen Drizzle Studio (browser UI)
pnpm email:debug / npm run email:debug / yarn email:debugRender or send a debug email
pnpm admin:grant-platform-admin / npm run admin:grant-platform-admin / yarn admin:grant-platform-adminGrant admin role to a user
pnpm lint / npm run lint / yarn lintRun ESLint
pnpm lint:fix / npm run lint:fix / yarn lint:fixAuto-fix ESLint issues
pnpm format / npm run format / yarn formatFormat with Prettier
pnpm format:check / npm run format:check / yarn format:checkCheck formatting only
pnpm typecheck / npm run typecheck / yarn typecheckRun Nuxt TypeScript checker
pnpm test / npm run test / yarn testRun Vitest unit tests
pnpm test:watch / npm run test:watch / yarn test:watchRun Vitest in watch mode
pnpm test:e2e / npm run test:e2e / yarn test:e2eRun Playwright E2E tests

See package.json for the full list of scripts.

NuxtBase supports three email drivers, controlled by NUXT_MAIL_DRIVER:

Terminal window
NUXT_MAIL_DRIVER=preview

Emails are rendered as HTML and saved to .tmp/email-previews/. No SMTP server needed. Open the HTML files in your browser to review.

Mailpit is a local SMTP server with a web UI — the best option for testing email delivery locally.

Terminal window
docker run -d --name mailpit -p 8025:8025 -p 1025:1025 axllent/mailpit

Then set in .env:

Terminal window
NUXT_MAIL_DRIVER=smtp
NUXT_SMTP_HOST=127.0.0.1
NUXT_SMTP_PORT=1025
NUXT_SMTP_SECURE=false

View emails at http://localhost:8025.

Render a specific email template without triggering the actual flow:

Terminal window
# Render to preview file
pnpm email:debug -- --template verify-email
# Send to a real address via the configured driver
pnpm email:debug -- --template verify-email --send --to you@example.com

Available templates: verify-email, reset-password, organization-invitation, subscription-change, credits-alert, magic-link.

To test Stripe webhooks locally, install the Stripe CLI and forward events to your dev server:

Terminal window
stripe listen --forward-to localhost:3000/api/billing/webhook

The CLI prints a webhook signing secret (whsec_...). Set it in .env:

Terminal window
NUXT_STRIPE_WEBHOOK_SECRET=whsec_...

When you change a Drizzle schema file in server/database/schema/:

Terminal window
# 1. Generate a migration from your schema changes
pnpm db:generate
# 2. Apply the migration
pnpm db:migrate

To browse your database:

Terminal window
pnpm db:studio

This opens Drizzle Studio at https://local.drizzle.studio.

The project uses Husky hooks for local quality gates.

  • on git commit, Husky runs lint-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:

Terminal window
pnpm lint # check for issues
pnpm lint:fix # auto-fix
pnpm format # format all files
pnpm typecheck # TypeScript checks
├── 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