Skip to content
TheChatArchiveThe Chat Archive
ClaudeClaude Haiku 4.5· anthropicHugging Face Frontier Reasoning Traces

Generate a Vue 3 + Pinia full-stack boilerplate with module federation. Structure it so…

  1. User

    Generate a Vue 3 + Pinia full-stack boilerplate with module federation. Structure it so Dashboard and Settings are separate micro-frontends that deploy independently but load into the main shell app at runtime.

  2. Claude Assistant

    This is a comprehensive request for a Vue 3 + Pinia full-stack boilerplate with module federation. The user wants:

    1. A main shell app
    2. Dashboard micro-frontend
    3. Settings micro-frontend
    4. All using Vue 3 + Pinia
    5. Module Federation for runtime loading
    6. Independent deployability

    I'll create a complete structure with:

    • Shell application
    • Dashboard micro-app
    • Settings micro-app
    • Shared store (Pinia)
    • Configuration files (Vite)
    • Docker setup for independent deployments
    • Example components and pages

    Let me structure this properly with all necessary files.

    Vue 3 + Pinia Full-Stack Boilerplate with Module Federation

    Here's a comprehensive setup for a micro-frontend architecture:

    Project Structure

    project-root/
    ├── shell/                      # Main shell application
    ├── dashboard/                  # Dashboard micro-frontend
    ├── settings/                   # Settings micro-frontend
    ├── shared/                     # Shared utilities and types
    └── docker-compose.yml
    

    1. Shared Library Setup

    shared/package.json

    {
      "name": "@mfe/shared",
      "version": "1.0.0",
      "type": "module",
      "main": "./dist/index.js",
      "types": "./dist/index.d.ts",
      "files": [
        "dist"
      ],
      "exports": {
        ".": {
          "types": "./dist/index.d.ts",
          "import": "./dist/index.js"
        },
        "./stores": {
          "types": "./dist/stores/index.d.ts",
          "import": "./dist/stores/index.js"
        },
        "./types": {
          "types": "./dist/types/index.d.ts"
        }
      },
      "dependencies": {
        "pinia": "^2.1.7",
        "vue": "^3.3.13"
      },
      "devDependencies": {
        "@types/node": "^20.11.0",
        "typescript": "^5.3.3",
        "vite": "^5.0.10"
      }
    }
    

    shared/src/types/index.ts

    export interface User {
      id: string;
      name: string;
      email: string;
      role: 'admin' | 'user';
    }
    
    export interface AppState {
      currentUser: User | null;
      isAuthenticated: boolean;
      theme: 'light' | 'dark';
    }
    
    export interface MenuItem {
      id: string;
      label: string;
      route: string;
      icon: string;
      children?: MenuItem[];
    }
    

    shared/src/stores/userStore.ts

    import { defineStore } from 'pinia';
    import { ref, computed } from 'vue';
    import type { User } from '../types';
    
    export const useUserStore = defineStore('user', () => {
      const currentUser = ref<User | null>(null);
      const isAuthenticated = ref(false);
      const token = ref<string | null>(null);
    
      const isAdmin = computed(() => currentUser.value?.role === 'admin');
    
      async function login(email: string, password: string) {
        try {
          // Mock API call
          const response = await fetch('/api/auth/login', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify({ email, password }),
          });
    
          if (!response.ok) throw new Error('Login failed');
    
          const data = await response.json();
          currentUser.value = data.user;
          token.value = data.token;
          isAuthenticated.value = true;
    
          localStorage.setItem('auth_token', data.token);
        } catch (error) {
          console.error('Login error:', error);
          throw error;
        }
      }
    
      async function logout() {
        currentUser.value = null;
        isAuthenticated.value = false;
        token.value = null;
        localStorage.removeItem('auth_token');
      }
    
      async function initializeFromToken() {
        const token = localStorage.getItem('auth_token');
        if (token) {
          try {
            const response = await fetch('/api/auth/me', {
              headers: { Authorization: `Bearer ${token}` },
            });
            if (response.ok) {
              const data = await response.json();
              currentUser.value = data.user;
              isAuthenticated.value = true;
              this.token = token;
            } else {
              localStorage.removeItem('auth_token');
            }
          } catch (error) {
            console.error('Token validation error:', error);
          }
        }
      }
    
      return {
        currentUser,
        isAuthenticated,
        token,
        isAdmin,
        login,
        logout,
        initializeFromToken,
      };
    });
    

    shared/src/stores/appStore.ts

    import { defineStore } from 'pinia';
    import { ref } from 'vue';
    
    export const useAppStore = defineStore('app', () => {
      const theme = ref<'light' | 'dark'>('light');
      const sidebarOpen = ref(true);
      const notifications = ref<
        Array<{ id: string; message: string; type: 'success' | 'error' | 'warning'; timestamp: number }>
      >([]);
    
      function toggleTheme() {
        theme.value = theme.value === 'light' ? 'dark' : 'light';
        localStorage.setItem('theme', theme.value);
      }
    
      function toggleSidebar() {
        sidebarOpen.value = !sidebarOpen.value;
      }
    
      function addNotification(
        message: string,
        type: 'success' | 'error' | 'warning' = 'success',
      ) {
        const id = Date.now().toString();
        notifications.value.push({ id, message, type, timestamp: Date.now() });
    
        setTimeout(() => {
          notifications.value = notifications.value.filter((n) => n.id !== id);
        }, 3000);
      }
    
      function initializeTheme() {
        const stored = localStorage.getItem('theme');
        if (stored) {
          theme.value = stored as 'light' | 'dark';
        } else {
          const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
          theme.value = prefersDark ? 'dark' : 'light';
        }
      }
    
      return {
        theme,
        sidebarOpen,
        notifications,
        toggleTheme,
        toggleSidebar,
        addNotification,
        initializeTheme,
      };
    });
    

    shared/src/stores/index.ts

    export { useUserStore } from './userStore';
    export { useAppStore } from './appStore';
    

    shared/src/index.ts

    export * from './stores';
    export * from './types';
    

    2. Shell Application

    shell/package.json

    {
      "name": "shell",
      "private": true,
      "version": "0.0.1",
      "type": "module",
      "scripts": {
        "dev": "vite",
        "build": "vite build",
        "preview": "vite preview",
        "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
      },
      "dependencies": {
        "@mfe/shared": "workspace:*",
        "pinia": "^2.1.7",
        "vue": "^3.3.13",
        "vue-router": "^4.3.2"
      },
      "devDependencies": {
        "@vitejs/plugin-vue": "^5.0.4",
        "@vue/test-utils": "^2.4.3",
        "typescript": "^5.3.3",
        "vite": "^5.0.10",
        "vue-tsc": "^1.8.27"
      }
    }
    

    shell/vite.config.ts

    import { defineConfig } from 'vite';
    import vue from '@vitejs/plugin-vue';
    import { federation } from '@originjs/vite-plugin-federation';
    import path from 'path';
    
    export default defineConfig({
      plugins: [
        vue(),
        federation({
          name: 'shell',
          filename: 'remoteEntry.js',
          remotes: {
            dashboard: process.env.DASHBOARD_URL || 'http://localhost:5173/dist/remoteEntry.js',
            settings: process.env.SETTINGS_URL || 'http://localhost:5174/dist/remoteEntry.js',
          },
          exposes: {
            '.': './src/index.ts',
          },
          shared: [
            'vue',
            'vue-router',
            'pinia',
            '@mfe/shared',
          ],
        }),
      ],
      resolve: {
        alias: {
          '@': path.resolve(__dirname, './src'),
          '@shared': path.resolve(__dirname, '../shared/src'),
        },
      },
      server: {
        port: 5172,
        strictPort: true,
        cors: true,
      },
      build: {
        target: 'esnext',
        minify: false,
        cssCodeSplit: false,
        rollupOptions: {
          output: {
            minifyInternalExports: false,
          },
        },
      },
    });
    

    Note: Install federation plugin: npm install @originjs/vite-plugin-federation

    shell/src/main.ts

    import { createApp } from 'vue';
    import { createPinia } from 'pinia';
    import router from './router';
    import App from './App.vue';
    import './style.css';
    
    async function bootstrap() {
      const app = createApp(App);
      const pinia = createPinia();
    
      app.use(pinia);
      app.use(router);
    
      app.mount('#app');
    }
    
    bootstrap().catch((err) => console.error('Bootstrap error:', err));
    

    shell/src/App.vue

    <template>
      <div :class="['app', `theme-${theme}`]">
        <div class="app-wrapper">
          <!-- Header -->
          <header class="app-header">
            <div class="header-content">
              <h1>MFE Shell</h1>
              <nav class="header-nav">
                <router-link to="/">Home</router-link>
                <router-link to="/dashboard">Dashboard</router-link>
                <router-link to="/settings">Settings</router-link>
                <button @click="toggleTheme" class="theme-toggle">
                  {{ theme === 'light' ? '🌙' : '☀️' }}
                </button>
              </nav>
            </div>
          </header>
    
          <!-- Main Content -->
          <main class="app-main">
            <aside v-if="sidebarOpen" class="app-sidebar">
              <nav class="sidebar-nav">
                <div class="sidebar-section">
                  <h3>Applications</h3>
                  <ul>
                    <li>
                      <router-link to="/dashboard" class="nav-link">
                        <span class="icon">📊</span> Dashboard
                      </router-link>
                    </li>
                    <li>
                      <router-link to="/settings" class="nav-link">
                        <span class="icon">⚙️</span> Settings
                      </router-link>
                    </li>
                  </ul>
                </div>
              </nav>
            </aside>
    
            <div class="app-content">
              <router-view v-slot="{ Component }">
                <Suspense>
                  <component :is="Component" />
                  <template #fallback>
                    <div class="loading">Loading...</div>
                  </template>
                </Suspense>
              </router-view>
            </div>
          </main>
    
          <!-- Notifications -->
          <div class="notifications">
            <transition-group name="fade">
              <div
                v-for="notification in notifications"
                :key="notification.id"
                :class="['notification', `notification-${notification.type}`]"
              >
                {{ notification.message }}
              </div>
            </transition-group>
          </div>
        </div>
      </div>
    </template>
    
    <script setup lang="ts">
    import { useAppStore } from '@mfe/shared';
    import { computed } from 'vue';
    
    const appStore = useAppStore();
    
    const theme = computed(() => appStore.theme);
    const sidebarOpen = computed(() => appStore.sidebarOpen);
    const notifications = computed(() => appStore.notifications);
    
    const toggleTheme = () => appStore.toggleTheme();
    </script>
    
    <style scoped>
    .app {
      min-height: 100vh;
      transition: background-color 0.3s, color 0.3s;
    }
    
    .app.theme-light {
      background-color: #f5f5f5;
      color: #333;
    }
    
    .app.theme-dark {
      background-color: #1a1a1a;
      color: #e0e0e0;
    }
    
    .app-wrapper {
      display: flex;
      flex-direction: column;
      min-height: 100vh;
    }
    
    .app-header {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;
      padding: 1rem;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .header-content {
      max-width: 1400px;
      margin: 0 auto;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    
    .header-nav {
      display: flex;
      gap: 1.5rem;
      align-items: center;
    }
    
    .header-nav a {
      color: white;
      text-decoration: none;
      padding: 0.5rem 1rem;
      border-radius: 4px;
      transition: background-color 0.2s;
    }
    
    .header-nav a:hover {
      background-color: rgba(255, 255, 255, 0.2);
    }
    
    .header-nav a.router-link-active {
      background-color: rgba(255, 255, 255, 0.3);
    }
    
    .theme-toggle {
      background: rgba(255, 255, 255, 0.2);
      border: 1px solid rgba(255, 255, 255, 0.3);
      color: white;
      padding: 0.5rem 1rem;
      border-radius: 4px;
      cursor: pointer;
      transition: background-color 0.2s;
      font-size: 1.2rem;
    }
    
    .theme-toggle:hover {
      background-color: rgba(255, 255, 255, 0.3);
    }
    
    .app-main {
      display: flex;
      flex: 1;
      max-width: 1400px;
      margin: 0 auto;
      width: 100%;
    }
    
    .app-sidebar {
      width: 250px;
      padding: 2rem 1rem;
      border-right: 1px solid #ddd;
    }
    
    .app.theme-dark .app-sidebar {
      border-right-color: #333;
    }
    
    .sidebar-section h3 {
      margin: 1rem 0 0.5rem;
      font-size: 0.8rem;
      text-transform: uppercase;
      opacity: 0.7;
    }
    
    .sidebar-nav ul {
      list-style: none;
      padding: 0;
    }
    
    .nav-link {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.75rem 1rem;
      color: inherit;
      text-decoration: none;
      border-radius: 4px;
      transition: background-color 0.2s;
    }
    
    .nav-link:hover {
      background-color: #f0f0f0;
    }
    
    .app.theme-dark .nav-link:hover {
      background-color: #333;
    }
    
    .app-content {
      flex: 1;
      padding: 2rem;
    }
    
    .loading {
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 400px;
      font-size: 1.2rem;
    }
    
    .notifications {
      position: fixed;
      top: 20px;
      right: 20px;
      z-index: 1000;
    }
    
    .notification {
      padding: 1rem;
      margin-bottom: 0.5rem;
      border-radius: 4px;
      color: white;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    .notification-success {
      background-color: #4caf50;
    }
    
    .notification-error {
      background-color: #f44336;
    }
    
    .notification-warning {
      background-color: #ff9800;
    }
    
    .fade-enter-active,
    .fade-leave-active {
      transition: opacity 0.3s, transform 0.3s;
    }
    
    .fade-enter-from,
    .fade-leave-to {
      opacity: 0;
      transform: translateX(20px);
    }
    
    @media (max-width: 768px) {
      .app-main {
        flex-direction: column;
      }
    
      .app-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ddd;
      }
    
      .header-nav {
        flex-wrap: wrap;
      }
    }
    </style>
    

    shell/src/router/index.ts

    import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
    import { defineAsyncComponent } from 'vue';
    
    const Home = () => import('../pages/Home.vue');
    
    // Lazy load micro-frontend routes
    const DashboardApp = defineAsyncComponent(() =>
      import('dashboard/App').catch(() => import('../pages/NotFound.vue')),
    );
    
    const SettingsApp = defineAsyncComponent(() =>
      import('settings/App').catch(() => import('../pages/NotFound.vue')),
    );
    
    const routes: RouteRecordRaw[] = [
      {
        path: '/',
        component: Home,
        meta: { title: 'Home' },
      },
      {
        path: '/dashboard',
        component: DashboardApp,
        meta: { title: 'Dashboard' },
      },
      {
        path: '/settings',
        component: SettingsApp,
        meta: { title: 'Settings' },
      },
      {
        path: '/:pathMatch(.*)*',
        component: () => import('../pages/NotFound.vue'),
      },
    ];
    
    const router = createRouter({
      history: createWebHistory(import.meta.env.BASE_URL),
      routes,
    });
    
    router.beforeEach((to, from, next) => {
      document.title = `${to.meta.title || 'App'} - MFE`;
      next();
    });
    
    export default router;
    

    shell/src/pages/Home.vue

    <template>
      <div class="home">
        <h1>Welcome to MFE Shell</h1>
        <p>This is the main shell application loaded with module federation.</p>
        
        <div class="cards">
          <router-link to="/dashboard" class="card">
            <h2>📊 Dashboard</h2>
            <p>Micro-frontend: Dashboard module</p>
          </router-link>
          
          <router-link to="/settings" class="card">
            <h2>⚙️ Settings</h2>
            <p>Micro-frontend: Settings module</p>
          </router-link>
        </div>
    
        <section class="info">
          <h2>Architecture</h2>
          <ul>
            <li>✅ Vue 3 + TypeScript</li>
            <li>✅ Pinia for state management</li>
            <li>✅ Module Federation</li>
            <li>✅ Independent deployments</li>
            <li>✅ Runtime loading</li>
          </ul>
        </section>
      </div>
    </template>
    
    <script setup lang="ts"></script>
    
    <style scoped>
    .home {
      max-width: 800px;
    }
    
    h1 {
      margin-bottom: 1rem;
      color: #667eea;
    }
    
    .cards {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
      gap: 1.5rem;
      margin: 2rem 0;
    }
    
    .card {
      display: block;
      padding: 1.5rem;
      background: white;
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      text-decoration: none;
      color: inherit;
      transition: transform 0.2s, box-shadow 0.2s;
    }
    
    .card:hover {
      transform: translateY(-4px);
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    }
    
    .card h2 {
      margin-top: 0;
      color: #667eea;
    }
    
    .info {
      margin-top: 2rem;
      padding: 1.5rem;
      background: #f5f5f5;
      border-radius: 8px;
    }
    
    .info ul {
      list-style: none;
      padding: 0;
    }
    
    .info li {
      padding: 0.5rem 0;
    }
    </style>
    

    shell/src/pages/NotFound.vue

    <template>
      <div class="not-found">
        <h1>404 - Page Not Found</h1>
        <p>The module you're looking for couldn't be loaded.</p>
        <router-link to="/" class="back-link">← Back to Home</router-link>
      </div>
    </template>
    
    <style scoped>
    .not-found {
      text-align: center;
      padding: 2rem;
    }
    
    h1 {
      color: #f44336;
      margin-bottom: 1rem;
    }
    
    .back-link {
      display: inline-block;
      margin-top: 1rem;
      padding: 0.75rem 1.5rem;
      background: #667eea;
      color: white;
      text-decoration: none;
      border-radius: 4px;
      transition: background-color 0.2s;
    }
    
    .back-link:hover {
      background-color: #764ba2;
    }
    </style>
    

    shell/src/style.css

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    
    html {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
        'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
      font-size: 16px;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
    }
    
    body {
      margin: 0;
      min-height: 100vh;
    }
    
    #app {
      min-height: 100vh;
    }
    
    button {
      cursor: pointer;
      border: none;
      font: inherit;
    }
    
    a {
      color: inherit;
      text-decoration: inherit;
    }
    
    input,
    textarea {
      font: inherit;
      color: inherit;
    }
    

    shell/src/shims-vue.d.ts

    declare module '*.vue' {
      import type { DefineComponent } from 'vue';
      const component: DefineComponent<{}, {}, any>;
      export default component;
    }
    
    declare module 'dashboard/App' {
      import type { DefineComponent } from 'vue';
      const component: DefineComponent<{}, {}, any>;
      export default component;
    }
    
    declare module 'settings/App' {
      import type { DefineComponent } from 'vue';
      const component: DefineComponent<{}, {}, any>;
      export default component;
    }
    

    3. Dashboard Micro-Frontend

    dashboard/package.json

    {
      "name": "dashboard",
      "private": true,
      "version": "0.0.1",
      "type": "module",
      "scripts": {
        "dev": "vite",
        "build": "vite build",
        "preview": "vite preview"
      },
      "dependencies": {
        "@mfe/shared": "workspace:*",
        "pinia": "^2.1.7",
        "vue": "^3.3.13"
      },
      "devDependencies": {
        "@vitejs/plugin-vue": "^5.0.4",
        "typescript": "^5.3.3",
        "vite": "^5.0.10",
        "vue-tsc": "^1.8.27"
      }
    }
    

    dashboard/vite.config.ts

    import { defineConfig } from 'vite';
    import vue from '@vitejs/plugin-vue';
    import { federation } from '@originjs/vite-plugin-federation';
    import path from 'path';
    
    export default defineConfig({
      plugins: [
        vue(),
        federation({
          name: 'dashboard',
          filename: 'remoteEntry.js',
          exposes: {
            './App': './src/App.vue',
          },
          shared: ['vue', 'pinia', '@mfe/shared'],
        }),
      ],
      resolve: {
        alias: {
          '@': path.resolve(__dirname, './src'),
          '@shared': path.resolve(__dirname, '../shared/src'),
        },
      },
      server: {
        port: 5173,
        strictPort: true,
        cors: true,
      },
      build: {
        target: 'esnext',
        minify: false,
        cssCodeSplit: false,
        rollupOptions: {
          output: {
            minifyInternalExports: false,
          },
        },
      },
    });
    

    dashboard/src/App.vue

    <template>
      <div class="dashboard">
        <h1>Dashboard</h1>
        <p>Welcome, {{ currentUser?.name || 'Guest' }}</p>
    
        <div class="grid">
          <div class="card stat">
            <h3>Users</h3>
            <p class="value">{{ stats.users }}</p>
          </div>
          <div class="card stat">
            <h3>Revenue</h3>
            <p class="value">${{ stats.revenue }}</p>
          </div>
          <div class="card stat">
            <h3>Growth</h3>
            <p class="value">{{ stats.growth }}%</p>
          </div>
          <div class="card stat">
            <h3>Active</h3>
            <p class="value">{{ stats.active }}</p>
          </div>
        </div>
    
        <div class="section">
          <h2>Recent Activity</h2>
          <table class="activity-table">
            <thead>
              <tr>
                <th>Date</th>
                <th>Event</th>
                <th>User</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody>
              <tr v-for="activity in activities" :key="activity.id">
                <td>{{ formatDate(activity.date) }}</td>
                <td>{{ activity.event }}</td>
                <td>{{ activity.user }}</td>
                <td :class="`status-${activity.status}`">{{ activity.status }}</td>
              </tr>
            </tbody>
          </table>
        </div>
    
        <button @click="refreshData" class="btn-primary">🔄 Refresh Data</button>
      </div>
    </template>
    
    <script setup lang="ts">
    import { ref, onMounted, computed } from 'vue';
    import { useUserStore } from '@mfe/shared';
    
    const userStore = useUserStore();
    const currentUser = computed(() => userStore.currentUser);
    
    const stats = ref({
      users: 1250,
      revenue: 45230,
      growth: 23,
      active: 892,
    });
    
    const activities = ref([
      {
        id: 1,
        date: new Date(Date.now() - 86400000),
        event: 'User registered',
        user: 'John Doe',
        status: 'completed',
      },
      {
        id: 2,
        date: new Date(Date.now() - 3600000),
        event: 'Payment processed',
        user: 'Jane Smith',
        status: 'completed',
      },
      {
        id: 3,
        date: new Date(),
        event: 'Report generated',
        user: 'Admin',
        status: 'pending',
      },
    ]);
    
    const formatDate = (date: Date) => {
      return new Intl.DateTimeFormat('en-US', {
        month: 'short',
        day: 'numeric',
        hour: '2-digit',
        minute: '2-digit',
      }).format(date);
    };
    
    const refreshData = () => {
      stats.value.users = Math.floor(Math.random() * 2000);
      stats.value.revenue = Math.floor(Math.random() * 100000);
      stats.value.growth = Math.floor(Math.random() * 50);
      stats.value.active = Math.floor(Math.random() * 1500);
    };
    
    onMounted(() => {
      userStore.initializeFromToken().catch(() => {
        console.log('Not authenticated');
      });
    });
    </script>
    
    <style scoped>
    .dashboard {
      padding: 1rem;
    }
    
    h1 {
      margin-bottom: 0.5rem;
      color: #667eea;
    }
    
    .grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 1.5rem;
      margin: 2rem 0;
    }
    
    .card {
      padding: 1.5rem;
      background: white;
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .card h3 {
      margin: 0 0 0.5rem;
      font-size: 0.9rem;
      text-transform: uppercase;
      opacity: 0.7;
    }
    
    .stat .value {
      margin: 0;
      font-size: 2rem;
      font-weight: bold;
      color: #667eea;
    }
    
    .section {
      margin: 2rem 0;
    }
    
    .section h2 {
      margin-bottom: 1rem;
    }
    
    .activity-table {
      width: 100%;
      border-collapse: collapse;
      background: white;
      border-radius: 8px;
      overflow: hidden;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .activity-table th {
      background: #f5f5f5;
      padding: 1rem;
      text-align: left;
      font-weight: 600;
      border-bottom: 2px solid #e0e0e0;
    }
    
    .activity-table td {
      padding: 1rem;
      border-bottom: 1px solid #e0e0e0;
    }
    
    .activity-table tr:last-child td {
      border-bottom: none;
    }
    
    .status-completed {
      color: #4caf50;
      font-weight: 600;
    }
    
    .status-pending {
      color: #ff9800;
      font-weight: 600;
    }
    
    .btn-primary {
      padding: 0.75rem 1.5rem;
      background: #667eea;
      color: white;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      font-weight: 500;
      transition: background-color 0.2s;
    }
    
    .btn-primary:hover {
      background-color: #764ba2;
    }
    
    @media (max-width: 768px) {
      .activity-table {
        font-size: 0.9rem;
      }
    
      .activity-table th,
      .activity-table td {
        padding: 0.75rem;
      }
    }
    </style>
    

    dashboard/src/shims-vue.d.ts

    declare module '*.vue' {
      import type { DefineComponent } from 'vue';
      const component: DefineComponent<{}, {}, any>;
      export default component;
    }
    

    4. Settings Micro-Frontend

    settings/package.json

    {
      "name": "settings",
      "private": true,
      "version": "0.0.1",
      "type": "module",
      "scripts": {
        "dev": "vite",
        "build": "vite build",
        "preview": "vite preview"
      },
      "dependencies": {
        "@mfe/shared": "workspace:*",
        "pinia": "^2.1.7",
        "vue": "^3.3.13"
      },
      "devDependencies": {
        "@vitejs/plugin-vue": "^5.0.4",
        "typescript": "^5.3.3",
        "vite": "^5.0.10",
        "vue-tsc": "^1.8.27"
      }
    }
    

    settings/vite.config.ts

    import { defineConfig } from 'vite';
    import vue from '@vitejs/plugin-vue';
    import { federation } from '@originjs/vite-plugin-federation';
    import path from 'path';
    
    export default defineConfig({
      plugins: [
        vue(),
        federation({
          name: 'settings',
          filename: 'remoteEntry.js',
          exposes: {
            './App': './src/App.vue',
          },
          shared: ['vue', 'pinia', '@mfe/shared'],
        }),
      ],
      resolve: {
        alias: {
          '@': path.resolve(__dirname, './src'),
          '@shared': path.resolve(__dirname, '../shared/src'),
        },
      },
      server: {
        port: 5174,
        strictPort: true,
        cors: true,
      },
      build: {
        target: 'esnext',
        minify: false,
        cssCodeSplit: false,
        rollupOptions: {
          output: {
            minifyInternalExports: false,
          },
        },
      },
    });
    

    settings/src/App.vue

    <template>
      <div class="settings">
        <h1>Settings</h1>
    
        <div class="settings-grid">
          <!-- Profile Settings -->
          <div class="settings-card">
            <h2>👤 Profile</h2>
            <div class="form-group">
              <label>Name</label>
              <input v-model="profile.name" type="text" placeholder="Your name" />
            </div>
            <div class="form-group">
              <label>Email</label>
              <input v-model="profile.email" type="email" placeholder="Your email" />
            </div>
            <button @click="saveProfile" class="btn-primary">Save Profile</button>
          </div>
    
          <!-- Theme Settings -->
          <div class="settings-card">
            <h2>🎨 Appearance</h2>
            <div class="form-group">
              <label>Theme</label>
              <div class="options">
                <label class="radio-label">
                  <input v-model="appStore.theme" type="radio" value="light" />
                  Light
                </label>
                <label class="radio-label">
                  <input v-model="appStore.theme" type="radio" value="dark" />
                  Dark
                </label>
              </div>
            </div>
            <div class="form-group">
              <label class="checkbox-label">
                <input v-model="preferences.compactMode" type="checkbox" />
                Compact Mode
              </label>
            </div>
            <button @click="savePreferences" class="btn-primary">Save Preferences</button>
          </div>
    
          <!-- Notification Settings -->
          <div class="settings-card">
            <h2>🔔 Notifications</h2>
            <label class="checkbox-label">
              <input v-model="notifications.email" type="checkbox" />
              Email Notifications
            </label>
            <label class="checkbox-label">
              <input v-model="notifications.push" type="checkbox" />
              Push Notifications
            </label>
            <label class="checkbox-label">
              <input v-model="notifications.sms" type="checkbox" />
              SMS Alerts
            </label>
            <button @click="saveNotifications" class="btn-primary">Save Notifications</button>
          </div>
    
          <!-- Security Settings -->
          <div class="settings-card">
            <h2>🔒 Security</h2>
            <button @click="changePassword" class="btn-secondary">Change Password</button>
            <button @click="enableTwoFactor" class="btn-secondary">
              {{ twoFactorEnabled ? '✓ 2FA Enabled' : 'Enable 2FA' }}
            </button>
            <button @click="logout" class="btn-danger">Logout</button>
          </div>
        </div>
      </div>
    </template>
    
    <script setup lang="ts">
    import { ref } from 'vue';
    import { useUserStore, useAppStore } from '@mfe/shared';
    
    const userStore = useUserStore();
    const appStore = useAppStore();
    
    const profile = ref({
      name: userStore.currentUser?.name || '',
      email: userStore.currentUser?.email || '',
    });
    
    const preferences = ref({
      compactMode: localStorage.getItem('compactMode') === 'true',
    });
    
    const notifications = ref({
      email: JSON.parse(localStorage.getItem('notifications.email') ?? 'true'),
      push: JSON.parse(localStorage.getItem('notifications.push') ?? 'true'),
      sms: JSON.parse(localStorage.getItem('notifications.sms') ?? 'false'),
    });
    
    const twoFactorEnabled = ref(JSON.parse(localStorage.getItem('twoFactorEnabled') ?? 'false'));
    
    const saveProfile = () => {
      localStorage.setItem('profile', JSON.stringify(profile.value));
      appStore.addNotification('Profile saved successfully', 'success');
    };
    
    const savePreferences = () => {
      localStorage.setItem('compactMode', String(preferences.value.compactMode));
      appStore.addNotification('Preferences saved', 'success');
    };
    
    const saveNotifications = () => {
      localStorage.setItem('notifications.email', String(notifications.value.email));
      localStorage.setItem('notifications.push', String(notifications.value.push));
      localStorage.setItem('notifications.sms', String(notifications.value.sms));
      appStore.addNotification('Notification settings saved', 'success');
    };
    
    const changePassword = () => {
      appStore.addNotification('Password change feature coming soon', 'warning');
    };
    
    const enableTwoFactor = () => {
      twoFactorEnabled.value = !twoFactorEnabled.value;
      localStorage.setItem('twoFactorEnabled', String(twoFactorEnabled.value));
      appStore.addNotification(
        `2FA ${twoFactorEnabled.value ? 'enabled' : 'disabled'}`,
        'success',
      );
    };
    
    const logout = async () => {
      await userStore.logout();
      appStore.addNotification('Logged out successfully', 'success');
    };
    </script>
    
    <style scoped>
    .settings {
      padding: 1rem;
    }
    
    h1 {
      margin-bottom: 2rem;
      color: #667eea;
    }
    
    .settings-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
      gap: 1.5rem;
    }
    
    .settings-card {
      padding: 1.5rem;
      background: white;
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .settings-card h2 {
      margin-top: 0;
      margin-bottom: 1rem;
      font-size: 1.2rem;
    }
    
    .form-group {
      margin-bottom: 1rem;
    }
    
    label {
      display: block;
      margin-bottom: 0.5rem;
      font-weight: 500;
    }
    
    input[type='text'],
    input[type='email'] {
      width: 100%;
      padding: 0.75rem;
      border: 1px solid #ddd;
      border-radius: 4px;
      font-size: 1rem;
    }
    
    input[type='text']:focus,
    input[type='email']:focus {
      outline: none;
      border-color: #667eea;
      box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
    }
    
    .options {
      display: flex;
      gap: 1rem;
    }
    
    .radio-label,
    .checkbox-label {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      cursor: pointer;
    }
    
    input[type='radio'],
    input[type='checkbox'] {
      cursor: pointer;
    }
    
    button {
      padding: 0.75rem 1.5rem;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      font-weight: 500;
      transition: background-color 0.2s;
      width: 100%;
      margin-bottom: 0.5rem;
    }
    
    .btn-primary {
      background: #667eea;
      color: white;
    }
    
    .btn-primary:hover {
      background-color: #764ba2;
    }
    
    .btn-secondary {
      background: #e0e0e0;
      color: #333;
    }
    
    .btn-secondary:hover {
      background-color: #d0d0d0;
    }
    
    .btn-danger {
      background: #f44336;
      color: white;
    }
    
    .btn-danger:hover {
      background-color: #d32f2f;
    }
    
    @media (max-width: 768px) {
      .settings-grid {
        grid-template-columns: 1fr;
      }
    }
    </style>
    

    settings/src/shims-vue.d.ts

    declare module '*.vue' {
      import type { DefineComponent } from 'vue';
      const component: DefineComponent<{}, {}, any>;
      export default component;
    }
    

    5. Docker Setup

    docker-compose.yml

    version: '3.8'
    
    services:
      shell:
        build:
          context: ./shell
          dockerfile: Dockerfile
        ports:
          - '5172:5172'
        environment:
          - DASHBOARD_URL=http://dashboard:5173/dist/remoteEntry.js
          - SETTINGS_URL=http://settings:5174/dist/remoteEntry.js
        depends_on:
          - dashboard
          - settings
        networks:
          - mfe-network
    
      dashboard:
        build:
          context: ./dashboard
          dockerfile: Dockerfile
        ports:
          - '5173:5173'
        networks:
          - mfe-network
    
      settings:
        build:
          context: ./settings
          dockerfile: Dockerfile
        ports:
          - '5174:5174'
        networks:
          - mfe-network
    
    networks:
      mfe-network:
        driver: bridge
    

    shell/Dockerfile

    FROM node:20-alpine AS builder
    
    WORKDIR /app
    COPY package.json pnpm-lock.yaml ./
    COPY shell ./shell
    COPY shared ./shared
    
    RUN npm install -g pnpm
    RUN pnpm install
    RUN cd shell && pnpm build
    
    FROM node:20-alpine
    
    WORKDIR /app
    RUN npm install -g serve
    
    COPY --from=builder /app/shell/dist ./dist
    
    EXPOSE 5172
    
    CMD ["serve", "-s", "dist", "-l", "5172"]
    

    dashboard/Dockerfile & settings/Dockerfile

    Same structure, adjust paths accordingly.

    6. Root package.json (Monorepo Setup)

    {
      "name": "mfe-monorepo",
      "description": "Vue 3 + Pinia Module Federation Monorepo",
      "private": true,
      "type": "module",
      "workspaces": [
        "shell",
        "dashboard",
        "settings",
        "shared"
      ],
      "scripts": {
        "dev": "pnpm -r dev",
        "build": "pnpm -r build",
        "preview": "pnpm -r preview",
        "docker:up": "docker-compose up -d",
        "docker:down": "docker-compose down"
      },
      "devDependencies": {
        "@originjs/vite-plugin-federation": "^1.2.4"
      }
    }
    

    7. Running the Application

    Development

    # Install dependencies
    pnpm install
    
    # Run all apps in parallel
    pnpm dev
    
    # Access:
    # - Shell: http://localhost:5172
    # - Dashboard: http://localhost:5173
    # - Settings: http://localhost:5174
    

    Production with Docker

    # Build and run
    pnpm docker:up
    
    # Access shell at http://localhost:5172
    

    Build for Production

    pnpm build
    
    # Outputs:
    # - shell/dist
    # - dashboard/dist
    # - settings/dist
    

    Key Features

    ✅ Module Federation - Independent micro-frontends
    ✅ Shared Stores - Pinia state management across apps
    ✅ Runtime Loading - No build-time dependencies
    ✅ Independent Deployments - Each app deploys separately
    ✅ Monorepo - Easy package management
    ✅ TypeScript - Full type safety
    ✅ Responsive UI - Mobile-friendly layout
    ✅ Theme Support - Light/Dark mode
    ✅ Docker Ready - Containerized deployment

    This boilerplate provides a production-ready foundation for building scalable micro-frontend applications with Vue 3!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.