Nuxt · Architecture

NUXT0109Keep types shared by server and app in shared/types

Report type imports of app code in Nuxt server code, including inline `type` specifiers next to values that need no app API.

Why it happens

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

Fix

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

Example

Share types through shared/types

Before

// server/api/cart.get.ts
import type { Cart } from '~/types/cart'

After

// shared/types/cart.ts
export interface Cart {
  items: string[]
}

// server/api/cart.get.ts: auto-imported
export default defineEventHandler((): Cart => ({ items: [] }))

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

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