Nuxt · NUXT0076

Keep types shared by app and server in shared/types

Report type-only imports from the Nuxt server directory in app or shared code.
NUXT0076vite-doctor/nuxtarchitectureinfoSuggestion

Run this rule

pnpm nuxt doctor --extends auto,nuxt/strict --rules nuxt/structure/no-server-types-in-app

Why it matters

Type-only imports are erased from the client bundle, but they couple app code to server internals. A refactor that adds a runtime import next to the type pulls server code into the client. Types used by both sides belong in shared/types/, which Nuxt auto-imports in both the app and the server.

Move types used by both the app and the server to shared/types/ and import them from there on both sides.

Example

Share types through shared/types

Before

// app/pages/orders.vue <script setup>
import type { Order } from '~~/server/utils/orders'

After

// shared/types/order.ts
export interface Order {
  id: string
  totalCents: number
}

// app/pages/orders.vue: auto-imported
const { data } = await useFetch<Order[]>('/api/orders')
Copyright © 2026