Interactive Lab

Nuxt 4 Architecture & Nuxt UI (Reka UI) Systems

Master the forward-compatible Nuxt 4 app/ root structure, universal useAsyncData lifecycles, and Nuxt UI design token customization.

Nuxt4Index.vue
// 1. Nuxt 4 Unified Directory Structure (app/)
// app/pages/index.vue
<script setup lang="ts">
// 2. Deduplicated, Universal Data Fetching with useAsyncData
const { data: telemetry, status } = await useAsyncData('cluster-health', () =>
  $fetch('/api/v1/metrics')
);

// 3. Nuxt UI / Reka UI Compound Component
const items = [
  [{ label: 'System Dashboard', icon: 'i-heroicons-chart-bar' }],
  [{ label: 'Disconnect', icon: 'i-heroicons-arrow-left-on-rectangle' }]
];
</script>

<template>
  <div class="p-6">
    <!-- Nuxt UI Dropdown with integrated Reka UI accessibility -->
    <UDropdown :items="items" :popper="{ placement: 'bottom-start' }">
      <UButton color="primary" variant="solid" label="Cluster Actions" />
    </UDropdown>

    <div v-if="status === 'pending'" class="skeleton-loader" />
    <pre v-else>{{ telemetry }}</pre>
  </div>
</template>

Nuxt 4 Paradigm Shifts

  • Unified app/ Directory: Consolidates application source files (app/pages, app/components, app/composables) into a single directory, leaving the project root dedicated to configuration and server engine layers.
  • Nuxt UI (Powered by Reka UI): Features first-class Tailwind v4 token support, accessible unstyled primitives, and native command palettes.
  • Predictable Data Lifecycles: useAsyncData and useFetch share cached payloads between server rendering and client hydration without duplicate network requests.
useAsyncData Lifecycle Simulator Nuxt 4 Fetch Engine
status: 'idle'
Hydrated Server Response:
Click execute to simulate server-to-client payload transfer.