Nuxt · NUXT0075

Do not import server code into app or shared code

Report runtime imports from the Nuxt server directory in app or shared code.
NUXT0075vite-doctor/nuxtarchitectureerrorSuggestion

Run this rule

pnpm nuxt doctor --rules nuxt/structure/no-server-utils-in-app

Why it matters

Nuxt's import protection doesn't block server/utils. Importing from it in app code ships server code (database clients, private config reads, Node APIs) into the client bundle. Code used by both sides belongs in shared/utils/, which Nuxt auto-imports in both the app and the server.

Move code used by both the app and the server to shared/utils/. Keep server-only logic in server/ and call it through an API route.

Example

Share utilities through shared/utils

Before

// app/components/PriceTag.vue <script setup>
import { formatPrice } from '~~/server/utils/pricing'

After

// shared/utils/format-price.ts
export function formatPrice(cents: number, currency: string) {
  return new Intl.NumberFormat('en', { style: 'currency', currency }).format(cents / 100)
}

// app/components/PriceTag.vue: auto-imported
const label = computed(() => formatPrice(props.cents, props.currency))
Copyright © 2026