Background

Server-side rendered apps typically require two separate builds: one for the browser and another for the server environment. Nitro introduced a third build that combines browser assets, SSR bundle, and API routes into a single, optimized, self-contained output. Output is ready to deploy on any hosting platform, often requiring zero or minimal configuration and no code changes.

NitroVite-v2.drawio.png

(For simplicity, some details, such as prerendering, are omitted from the diagram above.)

This design creates an open architecture that allows Nitro to function either as a standalone backend framework or as part of a meta-framework like Nuxt, while giving meta-frameworks the freedom to make their own frontend tooling choices.

While powerful, this approach also had some limitations with multi-builds:

Nitro Vite Plugin

The Vite team announced the Environment API in 2024, based on prior experience, which can turn Vite into a powerful build orchestrator with unified DX.

With Nitro v3, we are betting on Vite as a powerful Build orchestrator and Fetch API as a universal standard cross-env communication (see H3 Beta article).

NitroVite-prod.drawio.png

Thanks to the powerful Vite building blocks, the entire build configuration and pipeline can be easily defined via a simple Nitro Vite plugin in a unified and standard way for any meta-framework to extend.

Nitro Vite plugin introduces a new concept: Services. Services are nitro-managed fetchable Vite environments that can be defined by users or meta-frameworks and communicate with other services using the fetch() API.

For local development, the same configuration of environments and managed services is being used: