NuxtN
Nuxtβ€’4mo agoβ€’
5 replies
Hacktheblues

Working with Multiple Nuxt Projects in a Monorepo

Hi everyone πŸ‘‹

I'm building a monorepo that contains multiple Nuxt applications, and I'm looking for best practices around structure, shared code, and how to configure the build system efficiently.

Here's my current directory structure:

javascript/
β”œβ”€β”€ app1/
β”‚ β”œβ”€β”€ pages/
β”‚ β”œβ”€β”€ layouts/
β”‚ └── components/
β”œβ”€β”€ app2/
β”‚ β”œβ”€β”€ pages/
β”‚ β”œβ”€β”€ layouts/
β”‚ └── components/
└── shared/
β”œβ”€β”€ components/
β”œβ”€β”€ composables/
└── utils/


Each app1 and app2 is a standalone Nuxt 3 application with its own pages, layouts, and components. The shared/ folder contains reusable code that should be accessible by both apps β€” things like global components, composables, and utility functions.

βœ… What I’m trying to achieve:

Clearly separate app1 and app2 as independent Nuxt frontends (e.g., for different clients or parts of a platform)

Import shared code (components, composables, utils) from a central place without duplication

Use Vite (default in Nuxt 3) to efficiently handle dev/build for multiple apps

Avoid code duplication while keeping developer experience smooth

πŸ”§ Questions

What's the best way to structure a Nuxt monorepo with multiple apps and shared code?

How can I configure Vite (inside Nuxt) to:

Support multiple Nuxt app entry points?

Share code from a shared/ directory across apps?

Should shared/ be a local package (e.g., using npm link, pnpm workspace, or a custom alias)?

Is it better to use pnpm workspaces, Yarn workspaces, or a monorepo tool like Nx or TurboRepo with Nuxt?
Was this page helpful?